Tag: awk NR FNR

awk merge files base on the keyword

use the awk variables NR and FNR merge files base on the keywords. awk -F' ' 'NR==FNR{a[$1]=$2;}NR!=FNR{print $0, a[$1]}' test-4.txt test-5.txt...

awk NR FNR difference

Linux awk command can use variables NR and FNR to process multiple files. NR : ordinal number of the current record, multiple files self-increase FNR...