I am opening the multiple files with awk and i testing this command
I am trying this for testing
awk -F"," 'NR==FNR{print FILENAME} {print FILENAME}' file2.txt file1.txt
The second block should execute when NR != FNR but for me its executing all the time.
IS this syntax correct
Since you haven’t specified a pattern for the second action, it always executes. If you only want it to execute when NR!=FNR, try something like:
For better or worse, there’s no
elsefor patterns, so you normally end up specifying each explicitly.