also sprach Patrick Hsieh <pahud@pahud.net> [2002.07.18.1717 +0200]:
> How can grep or egrep pattern in a file and print the pattern only? I
> will not print the whole line. e.g. to search the email address in
> /var/log/mail.log. I am wondering is it possible to achieve this
> without writing a perl script?
Not with grep. But use sed:
sed -e 's,.*(pattern-to-match).*,\1,' < /var/log/mail.log
--
martin; (greetings from the heart of the sun.)
\____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
perl -e 'print "The earth is a disk!\n" if ( "a" == "b" );'
(dedicated to nori)
Attachment:
pgpDSbJz7Cq33.pgp
Description: PGP signature