[Novalug] sed syntax question
larkoc at iges.org
Thu Mar 8 20:02:58 EST 2007
I have spent nearly two hours trying to solve what I think should be a simple problem.
I have a file (an auto-generated html file in my specific case) which is only one line.
One very, very looonng line.
I would like to automatically parse it to extract a word. Because the file is a single line, I am
trying to use the sed command to insert (or substitute, I'm not picky here) a newline or carriage
return character in an effort to break the single line up into smaller lines for subsequent (g)awk -ing.
I have tried many versions of:
cat ftp.html | sed i/bytes/bytes\n > meg
cat ftp2u.html | sed i/bytes/\n/ > meg
The results are indeed in the "meg" output file---one line with "/bytes/bytesn" or "/bytes" and a
second line which is the entire ftp.html one long-line file.
I have tried:
cat ftp.html | sed s/bytes/bytes\n/ > meg
The result is only the one long-line file; no newlines inserted following the character string "bytes".
I've been looking in O'Reillys "sed & awk" 2nd Edition but I'm not finding what I need. The index
for "insert" (Chapter on insert pp 87-90), "newline" and "return" have shown the special chars but
not enough of an example for me to get the syntax I would like to be correct.
Any directions on where I should look for this?
More information about the Novalug