Re: sed -f



Sun, 28 Mar 2010 16:34:37 +0100, pk did cat :

Loki Harfagr wrote:

Sun, 28 Mar 2010 11:42:40 +0100, pk did cat :

Loki Harfagr wrote:

sed -f filename list_raw > list

but it results in

sed: file filename line 21: Unterminated `s'
sed -n '/^New/p'
s/^New /!d

Have another beer, then try to be helpful,

in case your problem comes from the '!' try this workaround: $ sed -n
'/^New/p' file

or maybe try it the funny way:
$ sed '/^[^N][^e][^w]/d' file

This is slightly different, as it will not delete things like /^Med/
or /^Nxx/ which the OP probably wants to delete.

Yup, that's right, this should then do, steer crazy but working ;-) $
<file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d'

Not yet :-)

You also have to consider lines *shorter* than three characters, which
have to be deleted as well as there's obviously no way they can match
/^New/:

Oh! oops, er... yes! that's a really good black sunday for me !-D)


$ <file sed '/^..[^w]/d' | sed '/^.[^e]./d' | sed '/^[^N]../d' | \ sed
'/^.\{0,2\}$/d'

Removing some redundancy and putting everything in a single program, we
have

$ <file sed '/^..[^w]/d;/^.[^e]/d; /^[^N]/d; /^.\{0,2\}$/d'

Seriosuly, use /^New/! and be happy :-)

Oh well, yes, I wouldn't use the last posts I made, except " sed -n '/^New /p' "
but that was only in case the OP was really cornered to have and use ludicrous
extents ,-)
.


Quantcast