Editing huge Unix files

calbear2000

Golden Member
Oct 17, 2001
1,027
0
0
I have a huge text file that I need to edit (just need to edit top 10 lines of that file) Its so big that vi and emacs can't handle it. Is there another editor I can use? (I'm sure pico will crash too) Is there an easy way to just edit the top part of the file without having to read the entire thing in?

Thanks
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
gnu-ed may be what you need. Its a line editor so I think it just loads the current line into memory, not sure though. Also think of using sed or something similar to edit the file. What kind of file is it? If it is a log file, think about rotating them more often. I cant think of any other types of files that would be too large for vi or emacs.
 

cureless

Member
Apr 25, 2001
94
0
0
What's the size of the file?

I always thought vim's limit on file size was pretty big. (I thought the same about emacs).

Couldn't you use dd to get the beggining of the file, edit and put it back? I've used that for hard disks and it works.

cl
 

Damascus

Golden Member
Jul 15, 2001
1,434
0
0
How big is the file? I've used the Midnight Commander built in text editor (mcedit)
to poke around my 50MB log files and everything is still working.
 
Sep 3, 2001
131
0
0
There is a line editor built into vi/vim which should work for what you want to do. It's called 'ex' and should be explained in any decent vi tutorial.
 

Armitage

Banned
Feb 23, 2001
8,086
0
0
You could use head to grab the top 10 lines of the file into another file, where you could edit them.
Then you could use tail to grab everything but the first 10 lines of the original file, and cat the edited 10 lines back onto it.

Kind of a kluge, but it should work.

Depending on what kind of edits you need to do, sed or awk might work as well.
 

manly

Lifer
Jan 25, 2000
11,855
2,808
136
emacs doesn't read the whole file in. It reads parts of the file on demand.

I've opened up some pretty big files in emacs before; how big is too big for emacs to handle?
 

DaHitman

Golden Member
Apr 6, 2001
1,158
0
0
Let me introduce you to "head" and "tail"...

to see first 10 lines in a file:

head -n 10 <filename>

to see last 10 lines in a file tail -n 10 <filename>


See man pages for more info.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |