Issue
I can't figure how to tell sed to dot match new line:
echo -e "one\ntwo\nthree" | sed 's/one.*two/one/m'
I expect to get:
one
three
instead I get the original:
one
two
three
Solution
sed
is line-based tool. I don't think these is an option.
You can use h/H
(hold), g/G
(get).
$ echo -e 'one\ntwo\nthree' | sed -n '1h;1!H;${g;s/one.*two/one/p}'
one
three
Maybe you should try vim
:%s/one\_.*two/one/g
Answered By - kev Answer Checked By - Senaida (WPSolving Volunteer)