I can't figure how to tell sed dot match new line:
echo -e "one two three" | sed 's/one.*two/one/m'
I expect to get:
one three
instead I get original:
one two three
sed is line-based tool. I don't think these is an option. You can use h/H(hold), g/G(get).
sed
h/H
g/G
$ echo -e 'one two three' | sed -n '1h;1!H;${g;s/one.*two/one/p}' one three
Maybe you should try vim
vim
:%s/one\_.*two/one/g
1.4m articles
1.4m replys
5 comments
57.0k users