« sendmail .forward | Main | anti spam »

regexp return only match

useful command line perl for doing a grep but only returning the matched string, not the whole line:

cat filename | perl -ne 'if($_ =~ /regexpr/) { print('$&
');}'

can't help thinking you should be able to do this with grep...

About

This page contains a single entry from the blog

The previous post in this blog was sendmail .forward.

The next post in this blog is anti spam.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33