[beyes@beyes sed]$ cat test.txt
hello world
hello linux
hello unix
hello groad
[beyes@beyes sed]$ sed 'G' test.txt
hello world
hello linux
hello unix
hello groad
[beyes@beyes sed]$ tac test.txt
hello groad
hello unix
hello linux
hello world
[beyes@beyes sed]$ sed -n '1!G;h;$p' test.txt
hello groad
hello unix
hello linux
hello world
one
three
echo -e 'one\\ntwo\\nthree' | sed -n 's/one\\ntwo/one/p'
one
two
three
$ echo -e 'one\\ntwo\\nthree' | sed -n '1h;1!H;${g;s/one.*two/one/p}'
one
three
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |