Reputation: 31256
I have a makefile, and I am trying to use awk in a one liner inside of it:
# makefile
...
SHELL := /bin/bash
my_rule:
ls dir | awk -v path=$(current_dir) '{print path"/"$1}' > some_file
however, I can't seem to get make to drop the $1
into awk. How do I escape/access the field variables in awk, within the makefile?
Upvotes: 1
Views: 146
Reputation: 1717
This should do it:
# makefile
SHELL := /bin/bash
my_rule:
ls dir | awk -v path=$(current_dir) '{print $$path"/"$$1}' > some_file
Upvotes: 2
Reputation: 133650
Try changing $
to $$
in makefile to make awk
read it as correct field.
Upvotes: 2