In awk , if I give more than one file as an awk argument, there are two special variables:
NR = line number corresponding to all lines in all files.
FNR = line number of the current file.
I know that in Perl $. matches NR (current line among lines in all files).
Is there anything comparable to Perl's FNR AWK?
Let's say I have some command line:
perl -pe 'print filename,<something special which hold the current file line number>' *.txt
This should give me a conclusion, for example:
file1.txt 1 file1.txt 2 file2.txt 1
Vijay
source share