I'm trying to use the built-in variable called FILENAME.
According to the manual pages (HP-UX-11.00) for awk it says: "FILENAME A pathname of the current input file."
My awk script:
BEGIN {
printf("%s (", FILENAME)
}
{
# print a * every 2'000 lines of input
if ( statusCounter == 2000 ) {
printf("*"
statusCounter = 0
}
else statusCounter++
}
END {
printf(""
}
The desired output should look like this:
mypath1/myfile1name (***********)
mypath2/myfile2name (**************)
mypath3/myfile3name (*********)
Instead I get:
(***********)
(**************)
(*********)
I do not understand where the fault is or why I don't get the filename displayed. Any ideas?
According to the manual pages (HP-UX-11.00) for awk it says: "FILENAME A pathname of the current input file."
My awk script:
BEGIN {
printf("%s (", FILENAME)
}
{
# print a * every 2'000 lines of input
if ( statusCounter == 2000 ) {
printf("*"
statusCounter = 0
}
else statusCounter++
}
END {
printf(""
}
The desired output should look like this:
mypath1/myfile1name (***********)
mypath2/myfile2name (**************)
mypath3/myfile3name (*********)
Instead I get:
(***********)
(**************)
(*********)
I do not understand where the fault is or why I don't get the filename displayed. Any ideas?