# test.mk
test:
echo a b c | awk '{print $2}'
results in the following: (on both ubuntu and osx)
$ make -f test.mk
echo a b c | awk '{print }'
a b c
instead of:
$ make -f test.mk
echo a b c | awk '{print $2}'
b
have tried several combinations of ' and " but can't get figure out how to get make to print $2 literally and awk to substitute the second column
I have these two workarounds:
# test.mk with workaround #1
test:
test.sh
# test.sh
echo a b c | awk '{print $2}'
...and...
# test.mk with workaround #2
test:
echo a b c | cut -f2 -d" "
but I'm curious to find out if there is a way to put awk straight into the .mk file
Note: if you are pasting any of these .mk examples, you will probably have to turn the space indents back into tabs.