Monday, October 12, 2009

Filter out an email address from a pipe

tel blenkinsop | grep -o "[[:alnum:][:graph:]]*@[[:alnum:][:graph:]]*"

Where tel is a simple address book script, in this case I just want the email address and not the whole address

Labels:

Sunday, February 24, 2008

Sgrep : Super Grep?

No sgrep means Structured Grep but as far as I'm concerned it could be super-grep because it is a non-lined based grep.

# sgrep has the advantage of being non-line based
sgrep -i '("<h1>" .. "</h1>")' index.php
sgrep -i '("fred" .. "joe")' essay.txt
It gets really useful when you stream it
sgrep -i '("fred" .. "joe")' essay.txt | egrep -i 'keyword'


More details here http://www.cs.helsinki.fi/u/jjaakkol/sgrep.html

Labels: , , ,