• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Text editor in Unix

Broncho

Member
I am needing to edit huge text files in Unix. I'm talking files as large as 200 MB and possibly larger and I'm on an HP-Unix machine. Its running a 10.2 HP-UX version right now. I've been using VI, but it is limited to about 40 MB files. Does anyone have any ideas about an editor that could handle these larger file sizes?
 
emacs might be able to do it. vim may... But I doubt it. Some of the line editors might work even better. Or, if you can, try splitting the file up a bit before editting it.
 
What do you have to do with these files?
You might want to have a look at sed or awk which are stream editors/processors.
These basically stream the file through a set of rules, so you don't have to load the whole file at once.
 
Well, I'm having to do search and replaces, add line numbers and add information and the start of the file. The problem with VI is that I can't open the entire file to break it up into sections. I might be able to use awk, but I don't know much about it. Also, I was talking to a guy at work who manipulates big files on a Sun station and he said that standard EMACS couldn't handle the file sizes I talked about. He also said that he had seen someone else use a different version of EMACS that could handle the file size. Could that be XEMACS? The guy at work was using something called Window Open to edit large files, but I can't find any information on that. I appreciate the help so far guys.

Oh yeah, I don't currently have EMACS on my system, but I have found the page for GNU EMACS.
 
Go get the Oreilly sed & awk book. Those are some of the best tools you can learn. Of course, I need to brush up on my sed&awk too... 😛
 


<< Well, I'm having to do search and replaces, add line numbers and add information and the start of the file. >>



awk should be able to do this very easily for you.
As n0cmonkey suggested, the OReilly sed & awk book is excellent.
There are also some decent tutorials online that will get you started. Try googleing it 😀
 
Another nice thing about sed & awk ...
If you are doing the same sort of edit to a large number of files, you can make the awk commands into a script and automate the whole deal.
 
In AWK doesn't do it, I have the solution to all your problems: "man split" 😉

And a side note, gawk is much nicer to work with than awk, if you have it.
 
By default vi makes a backup of the file in the current directory for crash recovery, you may be able to open the whole thing if you disable this. Sorry I can't tell you exactly how, but I don't have access to HP-UX, only Linux and vim.
 
Thanks for the help guys. awk and split both have definite potential. It would be nice though if I could find an editor where I could look at the whole file at once. Thanks again for the help
 
Back
Top