FILENAME never gets a value when running gawk from a batch file
- From: di98mase <di98mase@xxxxxxxxxxx>
- Date: Fri, 29 Feb 2008 00:28:52 -0800 (PST)
Hi all,
after a few minutes of studying the FILENAME variable I cant
understand why my simple program does not work. This is what I want to
achieve:
I have a batch file that looks like:
echo "************************ Extract all general statistics
****************"
gawk -f statistics.awk <..\logs\%1 > ..\results\statistics.res
I run this using the command:
process_stats.bat mylogfile.log
in my awk program I have tried to use this in my END statement (since
the filename does not have any value in before the BEGIN is processed:
END {
print "Filename processed:", FILENAME;
}
I also tried:
BEGIN {
}
FNR == 1 { print "Filename processed:",FILENAME }
:
:
But both examples with the same result "Filename processed:-".
I cant see why this should not work? Is it because I use a input
parameter to the batch file?
/di98mase
.
- Follow-Ups:
- Prev by Date: Re: AWK Optimization
- Next by Date: Re: FILENAME never gets a value when running gawk from a batch file
- Previous by thread: AWK Optimization
- Next by thread: Re: FILENAME never gets a value when running gawk from a batch file
- Index(es):
Relevant Pages
|