Posts

Showing posts from December 20, 2009

Shell Script for Extracting all the lines containing a particular string

This we can do in many ways using AWK, SED, PERL etc Ex: Printing all the lines containing aaa in a file abc.txt Using AWK: awk '/aaa/{print}' abc.txt Using PERL:  perl -wn -e 'print if /aaa/' abc.txt This can be written into another file by using redirection as awk '/aaa/{print}' abc.txt  > tmp.txt perl -wn -e 'print if /aaa/' abc.txt > tmp.txt Regards G K Reddy Chinthalapudi