http://www.perlmonks.org?node_id=1059931


in reply to how to deal with newline

perl -ne 'print $1,"\n" foreach /[name|id]="(\w+)/' myfile.txt
update
on the second thought:
perl -ne 'print "$1\n" if /[name|id]="(\w+)/' myfile.txt
would be enough