perl -nle 'print $1 while /constant=(.*)\s/g' /home/jamie/txt #### xxxxxxxxx constant=foo@bar.com xxxxxxxxxxx xxxxxx constant=baz@huux.org xxxxxxx contant=hello@world.bye xxxxxxxxx xxxxxxxxxxxxxxxxxxx #### foo@bar.com baz@huux.org xxxxxxx contant=hello@world.bye