Reputation: 1099
I am writing the following command to extract the text in makefile:-
@awk '/Exported Layer/,/Total Polygons/' out_compare.err | perl -lane '$el=$F[3] if(/Exported Layer/); print "$el: $f[3]" if (/Total Polygons/);' | cat
But it is giving the following error:-
Can't modify constant item in scalar assignment at -e line 1, near "] if" Execution of -e aborted due to compilation errors.
Would you guys like to suggest something? :-)
Upvotes: 2
Views: 573
Reputation: 7005
Make is oblivious to shell quoting in commands, so the $
characters in your Perl snippet are being interpreted as make variables $e
and $F
. These variables don't exist in your makefile and are being expanded as empty, leading to the Perl syntax errors you're seeing.
You need to escape the $
characters from make like this:
... perl -lane '$$el=$$F[3] if(/Exported Layer/); ...
See also the GNU Make manual.
Upvotes: 5