On Thu, Jun 23, 2011 at 2:30 PM, Vaidik Kapoor <[email protected]> wrote: >> please give me any example. >> I want to replace several strings in the files using another string. > > Simple example for you: > > vaidik@altegammler:~/test$ echo "She sells sea shells on the sea shore." > > test.txt > vaidik@altegammler:~/test$ cat test.txt > She sells sea shells on the sea shore. > vaidik@altegammler:~/test$ sed 's/sea/SEA/g' test.txt > She sells SEA shells on the SEA shore. > vaidik@altegammler:~/test$ sed 's/sea/SEA/g' test_2.txt > sed: can't read test_2.txt: No such file or directory > vaidik@altegammler:~/test$ sed 's/sea/SEA/g' test.txt > test_2.txt > vaidik@altegammler:~/test$ cat test_2.txt > She sells SEA shells on the SEA shore. > vaidik@altegammler:~/test$ rm test.txt > vaidik@altegammler:~/test$ mv test_2.txt test.txt > vaidik@altegammler:~/test$ > > I hope this would help you. Also, check this out > http://sed.sourceforge.net/sed1line.txt. Besides all this, just Google about > how to use sed, awk, grep, egrep, etc. Google regular expressions if you > want to do complex text processing. Thank You very much :)) This is really helpful.
-- Parveen Arora www.parveenarora.in E-Mail: [email protected] -- Mailing list guidelines and other related articles: http://lug-iitd.org/Footer
