I prefer the one line python
or perl
command, both often included in major linux disdribution
echo $'<a href="http://stackoverflow.com"></a><a href="http://google.com"></a>' | python -c $'import reimport sysfor i in sys.stdin: g=re.match(r\'.*href="(.*)"\',i); if g is not None: print g.group(1)'
and to handle files:
ls *.txt | python -c $'import sysimport refor i in sys.stdin: i=i.strip() f=open(i,"r") for j in f: g=re.match(r\'.*href="(.*)"\',j); if g is not None: print g.group(1) f.close()'