On 5/11/05, Colin Carter
On Wednesday 11 May 2005 20:46, Damon Register wrote:
James D. Parra wrote:
Thanks Anders. However, I don't know where the text I need is located in the file. I need an editor that can actually open this file so I can look for
I am confused. When I was a kid my dad used to say "if you don't know what you are looking for, how will you know when you find it?" It seems you must know something about what you are looking for so why can't the Anders recommended SED find that text? Putting the size issue aside for a moment, why can't any editor find your text? Even the simplest Notepad in Windows can search.
Now I have a question about editors and big files. Does anyone remember the PDP-8? Twenty years ago when I started work here, there were a lot of PDP-8 word processors. They had a big 4K of RAM. When they opened a file, they didn't load the whole thing, just the first piece. As the user moved through the file, the computer would load the next piece. Does SED or any other editor have this abililty to load only a portion at a time? I could be wrong but it seems to me that this might be the only way to deal with such a large file. Actually, doesn't emacs do that?
IIRC, sed stands for "stream editor", It is non-interactive. It is typically used from shell scripts, or by gurus that have memorized its rather complex command-line argument structure.
You can even put sed in a pipeline: cat bigfile | sed AndersArgs > resulting_sub_section
So yes it works on files a little bit at a time. That is why Anders recommended it I'm sure.
Thank you all for your help. The problem I was having was in locating the last line number of the block I needed. I needed to grep for "\.", but grep was not interpreting that correctly. However, since I knew the first line number of the line number I needed I made a few guesses as to where the last line would be and I did eventually find it. The block of text I needed was 300Mb in size. I used "head" and "tail" to verify the start and end points for the new text file. Thank you, Anders, for your sed examples. They worked perfectly. Truly indebted, ~James