[H-GEN] sed query

Nick Kwiatkowski nickolas at au1.ibm.com
Tue May 6 09:18:39 EDT 2003


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





[ 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.
>

It is in the long run more embarrassing not to ask questions ....

> 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.

Sorry to ask the question, but what OS are you using ? Have you tried the
example on a smaller subset of the files to see if it is the size of the
file in question - ie cut -b 1-8192 <filename> to ge the first 8k of the
file ?

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

Have a look at http://sed.sourceforge.net/sedfaq.html especially section
4.1 "How do I insert a newline into the RHS of a substitution?"


Ciao,

Nik

Nickolas Kwiatkowski
IT Architect
AMS Solutions Enablement (ASE)
Application Management Services
IBM Global Services Australia
phone:  07 3887 6304,  mobile:  0412 121 276,  email:  nickolas at au1.ibm.com


--
* 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