[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: problems with awk in a make file



Dale Scheetz wrote:

I'm having a problem that I just can't understand. I have a log file that
contains, among other things, the line:

usf-tools 0.7.00

I have a make file with the line:

SVER := $(shell grep "usf-tools" ./logfile |awk 'NR == 1 { print $2 }')

that doesn't work properly. SVER for this line is set to:

usf-tools 0.7.00


I would do this
SVER := $(shell awk '/usf-tools/ { print $$2; exit; }' < logfile)

But the real problem is it is a makefile, and you need to double the dollar to pass it to the shell


Frank aka Myth



Reply to: