LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 10-12-2005, 05:33 PM   #1
linux.fob
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 :
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
 
Old 10-12-2005, 05:50 PM   #2
crabboy
Moderator
 
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
linux.fob
LQ Newbie
 
Registered: Oct 2005
Posts: 2

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


Reply


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
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 makefile.in or makefile.am 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 Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 01:23 PM
Can I use grep inside awk? Helene Programming 6 04-27-2004 01:58 AM


All times are GMT -5. The time now is 05:54 AM.

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