Monday 19 October 2009

grep using perl

I want to grep lines containing words like Broadcasts or broadcasts from a file like:

cat tv.txt :
this is british broadcasting channel in competition with other abc Broadcasts \n
and foo broadcasts telecasting \n
cricket \n

One-liner grep using perl :


perl -wnl -e 'm|Broadcasts|i and print $_;' tv.txt

No comments:

Post a Comment

Tweets by @sriramperumalla