Date: Thu, 30 Aug 2001 00:06:55 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Stijn Hoop <stijn@win.tue.nl> Cc: Odhiambo Washington <wash@wananchi.com>, FBSD-Q <freebsd-questions@freebsd.org> Subject: Re: another easy one for the script gurus Message-ID: <20010830000655.A5211@hades.hell.gr> In-Reply-To: <20010829181415.B21660@pcwin002.win.tue.nl>; from stijn@win.tue.nl on Wed, Aug 29, 2001 at 06:14:15PM %2B0200 References: <20010828191422.P14463@ns2.wananchi.com> <20010828233939.A12493@hades.hell.gr> <20010829180839.F7356@ns2.wananchi.com> <20010829181415.B21660@pcwin002.win.tue.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
From: Stijn Hoop <stijn@win.tue.nl> Subject: Re: another easy one for the script gurus Date: Wed, Aug 29, 2001 at 06:14:15PM +0200 > On Wed, Aug 29, 2001 at 06:08:39PM +0300, Odhiambo Washington wrote: > > | > > | You want in your Makefile something along the lines of: > > | > > | somefilename: > > | awk -F: '{print $$1,$$2}' < /etc/master.passwd > $@ > > | > > > > ## > > authtab: > > cat master.passwd.test | awk -F ":" '{if ($3>999) {print $1":"$2}}' > > ## > > In all that I expect it to generate the file called authtab. > > > > If I try your redirects (BTW what does $@ represent?) It generates errors > > > > alligator# make > > awk -F ":" '{if (>999) {print ":"}}' < master.passwd.test > authtab > > awk: cmd. line:1: {if (>999) {print ":"}} > > awk: cmd. line:1: ^ syntax error > > *** Error code 1 > > Stop in /etc/Exim. > > > > I don't get where the $3 disappears to. > > make also interprets variables, and those always happen to start with a > '$' by convention. make reads your line as having the variable $3 in it > which isn't defined, so it has the value ''. You need to double the $'s > for make to not interpret them. > > Also, having a target doesn't instruct make to automatically create a > file named like that; you have to explicitly redirect the output from > awk to a file named 'authtab', or to $@ which is a make variable meaning > 'the name of the current target'. > > Something like this should work better: > > authtab: > umask 077; cat master.passwd.test | \ > awk -F ":" '{if ($$3>999) {print $$1":"$$2}}' > $@ > > (Giorgios also posted a version of this above). Yes, the doubling of the '$' signs was intentional in my post. Washington, try duplicating the '$' signs that you want passed as single '$' signs in your Makefiles. -giorgos To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010830000655.A5211>