How to print filename with awk on Linux / Unix


#1

Originally published at: https://www.cyberciti.biz/faq/how-to-print-filename-with-awk-on-linux-unix/

I would like to print filename with awk on Linux / Unix-like system. How do I print filename in BEGIN section of awk? Can I print the name of the current input file using gawk/awk?