need sed help - how to replace all instances of X except those on lines with Y?
say I have a file:
Code:
foo bar Code:
oof bar |
One sed Example
If I correctly understood what you wrote, this seems to work:
#!/bin/sed /\(.*\)\(gah\)\(.*$\)/!s/foo/oof/g I wanted to find all lines without gah, and then do a simple substitution on those lines. You could do this with something more complicated, but then you'd be getting into parts of matches, which gets more complicat |
Quote:
|
Except it doesn’t have to be so complicated:
Code:
sed -e '/gah/!s/foo/oof/g' |
Quote:
|
All times are GMT -5. The time now is 04:28 PM. |