1757097 Members
2354 Online
108858 Solutions
New Discussion юеВ

how to view a large file

 
SOLVED
Go to solution
ng_7
Regular Advisor

how to view a large file

hi, experts,

I am using HP 11.11, I have problem vi a large file (300 over mb),

error : tmp file too large.

please guide me how to open such a large file

thanks

regards
ng

7 REPLIES 7
Rajeev  Shukla
Honored Contributor

Re: how to view a large file

Hi Ng,

By default when you vi any file it uses the /var/tmp as a temporary storage (that is if vi or system crashes you can recover the file). Usually if you dont have enough space in /var filesystem then vi'ing a file can fill /var.
You can temporarly export TMPDIR to any filesystem which has atleast free space greater than 300MB and then vi the file.
export TMPDIR= 300mb free>
vi file

Cheers
Rajeev
Mridul Shrivastava
Honored Contributor

Re: how to view a large file

Have a look at the following thread:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=898173
Time has a wonderful way of weeding out the trivial
Steven Schweda
Honored Contributor

Re: how to view a large file

> You can temporarly export TMPDIR to any
> filesystem [...]

I'd guess that you'd need to specify a
directory where you have write permission,
not simply any file system with some free
space. Disk quotas might also matter.
Dennis Handly
Acclaimed Contributor

Re: how to view a large file

Why would you want to use vi? The file is too big to edit.
Mridul's link shows how to split it up. Then you can edit the parts.

If you just want to look, you could use more(1). If you need to change lots of lines, you may want to use sed(1).
Suraj K Sankari
Honored Contributor
Solution

Re: how to view a large file

Hi,

You can do one thing break the file into small parts to read. first you have to konw the total no of lines to get this.

wc -l filename

then you can take first 5000 line into a file give this command

sed -n -e '1,5000p' filename>newfilename

this will extract first 5000 line into newfilename

Suraj
Arturo Galbiati
Esteemed Contributor

Re: how to view a large file

Hi,
by vi you can use the option -t (if I well rememeber) to eredefine the temp directory used.
HTH,
Art
Dennis Handly
Acclaimed Contributor

Re: how to view a large file

>Art: by vi you can use the option -t

Nothing like that on the man page, just TMPDIR.