Hm, you could simply put your query (the data-pattern) you are looking for between these symbols and demand strictly this by
'data-pattern'
whatever this data-pattern would contain ... even wild-cards are then
allowed too ...
this would look here as part of your intended usage of your command like
'"123" (123)'
or it would look like
\'"123" (123)\'
after your comment I added as follows (please dont downvote me - instead stay constructive with your opinion but do not use your thumbs like in cakepoof) so add or link your perl-line with a pipe to grep -e as follows :
perl -pe 'while (/(((.?[^)]))|(".?"))/g) {print "$1 ";} print "\n"' testdata | grep -e '"123" (123)'
or
perl -pe 'while (/(((.?[^)]))|(".?"))/g) {print "$1 ";} print "\n"' testdata | grep -e \'"123" (123)\'
-p
prints$_
. If you're going to do your own printing, use-n
. – muru May 03 '15 at 14:13