I found this in a embedded in a Makefile:
awk '/@/{print " \"" $$_ "\\n\"" }' file
I know the prototype of awk is:
awk 'pattern {action}' file
But what does @ and $$_ mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It looks like the underscore character is simply a variable in this case. And since it is not initialized, it has the value of zero. Thus,
$_is equivalent to$0, which refers to the entire line that was processed. I think that it could also have been written$xsince x would be an uninitialized variable.Since it appears in a makefile, two dollar signs are needed (it is a special character in a makefile) to produce a single dollar sign in the command.
And as already mentioned by Nemo, the
@is simply the pattern. Any line containing@would be matched.