regex - sed - Replacing from string to end-of-line -
this should incredibly easy can't work. want use sed replace 1 string end of line. example if have following data file:
1 2 3 5 4 2 5 five 6 6 1 2 7 4
and want replace word "two" through end of line word "blah" ending output:
1 blah 4 blah 6 1 blah
wouldn't be:
sed -e 's/two,$/blah/g'
i'm not best @ regex maybe that's problem
this should want:
sed 's/two.*/blah/'
$ echo " 1 2 3 5 > 4 2 5 five 6 > 6 1 2 7 four" | sed 's/two.*/blah/' 1 blah 4 blah 6 1 blah
the $
unnecessary because .*
finish @ end of line anyways, , g
@ end unnecessary because first match first two
end of line.
Comments
Post a Comment