FILENAME never gets a value when running gawk from a batch file



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




.



Relevant Pages

  • Batch File Rename + Date added & Move to another location
    ... be honest i cant quite find what im lookng for exactly. ... The original location ... I am new to batch file writing. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: how to use FOR in batch file to send DLLs to RegSer32 ?
    ... > someone else said I cant get it to scan SUB DIRS. ... > How would I add FOR in a batch file to resister OCXs + DLLs in the following ... > DIR structure assuming that I create a line in a batch file for each DIR? ...
    (microsoft.public.vb.general.discussion)
  • schedule task to run at night
    ... I have a small batch file that works I have tested it when working on my ... machines. ... I have indicated the correct user id and password but I ... still cant get this to run. ...
    (microsoft.public.windowsxp.general)
  • Re: Command Prompt Question
    ... This is all in a batch file so I cant simply add another line that ... The batch file executes this command in the ...
    (microsoft.public.windowsxp.general)
  • Re: I confess...
    ... studying the arcane mysteries of the Gorians. ... Only I cant find me bloody whip can I? ...
    (uk.misc)