[H-GEN] sed query

Scott Pullen spullen at optusnet.com.au
Tue May 6 07:52:54 EDT 2003


[ Humbug *General* list - semi-serious discussions about Humbug and     ]
[ Unix-related topics. Posts from non-subscribed addresses will vanish. ]

Let me start by saying that I know that this is a simple problem and
therefore I feel embarrassed even posting it but for the life of me I can't
get it to work.

I have received a file at work that must be the work of a mad genius.  They
have joined a large number of reasonably small (3 kb) ascii text files
together in such a way that all contents are on one line.  more seems to
handle the file and wrap the lines and displays the file.  vi reports that
the line is too long and won't display.

I thought that I could run the file through sed, insert some newlines as
appropriate and redirect the output into a new file and then be able to make
sense of the contents.  When I use:

sed -e 's/SOMETEXT/\n SOMETEXT/g' > output.txt

the output file is empty.  Is there anyway that a file could be large enough
to overflow sed and cause it to fail?  Being a stream editor I thought that
it should handle any length of line/file and just read to the end.  Memory
could not possibly be the problem unless sed is magically trying to store a
couple of thousand copies of the original file in memory.  sed does not
complain so I am at a loss.

I have tried escaping the newline i.e. \\n but that makes no difference.
Any suggestions would be greatly appreciated.

Cheers,

Scott.


--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.  See http://www.humbug.org.au/



More information about the General mailing list