Tag Archives: 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 Continue reading

Posted in Awk Command, Text Processing | Tagged , , , | Comments Off on awk merge files base on the keyword

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 : ordinal number of the current record in the current file awk NR example Processing … Continue reading

Posted in Awk Command | Tagged , , , | 3 Comments