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