1. from shell prompt
$> cat test.txt | sed 's/aaa/bb/g;s/cc/ddd/g' > newtest.txt
$> cat test.txt | sed '1,10s/aaa/bb/g;11,20s/cc/ddd/g' > newtest.txt
2. in VI
:%s/aa/bb/g #change the whole file
:s/aa/bb/g #change the current line
reference:
http://lowfatlinux.com/linux-sed.html
Thanks for sharing the article. Visit this link for more Sed command examples in unix
ReplyDelete