awk NR - Total Number of Records


Example

Will provide the total number of records processed in the current awk instance.

cat > file1
suicidesquad
harley quinn
joker
deadshot

cat > file2
avengers
ironman
captainamerica
hulk

awk '{print NR}' file1 file2
1
2
3
4
5
6
7
8

A total on 8 records were processed in the instance.