http://qs321.pair.com?node_id=732864


in reply to grep question using multiple lines

You might be able to do it in one line.

I am not sure what the criteria for finding the data is exactly. The example shows an email address, but you say the search text could be anything. Assuming per the example you are looking for the text following "constant=" up to the first space and there is only one instance per line, this worked for me:

perl -nle 'while(m/constant=(.*)\s/g){print "$1"}' /home/jamie/example +.txt
I tend to oversimplify things, so it may not be what you are looking for. But it is one line and it returns the data you were looking for.

Jamie