i have short bash code
cat example.txt | grep mail | awk -F, '{print $1}' | awk -F= '{print $2}'
I want to use it in perl script, and put its output to an array line by line.
I tried this but did not work
@array = system('cat /path/example.txt | grep mail | awk -F, {print $1} | awk -F= {print $2}');
Thanks for helping…
Try:
Noting that backticks are used and that the dollar signs need to be escaped as the qx operator will interpolate by default (i.e. it will think that $1 are Perl variables rather than arguments to awk).