LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   awk inside a makefile (https://www.linuxquestions.org/questions/programming-9/awk-inside-a-makefile-372390/)

linux.fob 10-12-2005 04:33 PM

awk inside a makefile
 
I am writing a Makefile and need to use simple awk command to parse a file.
my makefile looks like this :
Code:

SYSTEM=`cat /etc/redhat-release | awk -F" " '{ print $1 }' `
when I execute the makefile, The $1 in the awk script is substituted by make by an empty space since $1 is taken as a make variable , when it is actually a awk variable. Is there any way I can get makefile to escape resolving $1 .. I tried to escape the $1 as \$1 but then awk complains as bad command.
is there any way to this any other way ?

Thanks.
Pyro

crabboy 10-12-2005 04:50 PM

You can try using cut or a set of cuts.

linux.fob 10-12-2005 04:57 PM

Hey thanks for that tip.. I got cut to work :). thanks.


All times are GMT -5. The time now is 03:17 PM.