LinuxAnswers - the LQ Linux tutorial section.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-12-2005, 05:33 PM   #1
LQ Newbie
Registered: Oct 2005
Posts: 2

Rep: Reputation: 0
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 :
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 ?

Old 10-12-2005, 05:50 PM   #2
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
You can try using cut or a set of cuts.
Old 10-12-2005, 05:57 PM   #3
LQ Newbie
Registered: Oct 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Hey thanks for that tip.. I got cut to work . thanks.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I use grep inside awk? Helene Programming 10 09-29-2015 09:48 PM
iptables inside client to inside host with outside DNS or IP - Help! linuxhelp2 Linux - Networking 1 10-15-2005 07:19 AM
How to modify or QiangWan Linux - Newbie 1 05-17-2005 12:07 PM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 04:57 AM
generate Makefile from without calling ./configure ? chris78 Programming 2 05-02-2004 01:23 PM

All times are GMT -5. The time now is 07:11 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration