sed substitution conditional
on lines beginning with echo, globally substitute text with subtext:
sed '/^echo/s/text/subtext/g' ok, i got that. what i want to do is to wrap ^echo into a not! conditional: sed '/!(^echo)/s/text/bustext/g' wondering what the syntax would be to make it like that... i can exclude based on the first character: sed '/^[^e]/s/text/bustext/g' but then lines beginning with en, etc., are also excluded. i would like to be able to exclude based on a pattern at the beginning of a line, not just a character. i've tried lostsa syntactical? combinations, nothing seems to work... thanks. |
You're going about it in the right manner but in the wrong place.
Try Code:
sed '/^echo/!s/text/subtext/g' I hope this meets your needs. |
yes it does, works like a champ. excellent. muchos gracias.
|
naturally, an hour later i find the exact answer frob gave while looking for something else... the !s syntax is listed in a great sed one-liners file that i already had a copy of..:
http://www.student.northpark.edu/pem...d/sed1line.txt i had looked, can't believe i missed it. doh... |
All times are GMT -5. The time now is 06:31 PM. |