rohitprajapati
2/19/2016 - 7:45 AM

Multiple input file awk command.

Multiple input file awk command.

# Usage: awk -f multiple_input_file.awk ~/Desktop/test_1.csv ~/Desktop/test_2.csv

BEGIN {
	FS = ","
	OFS = ","
}

FNR == 1 {
	FILE_NUM++
}

FILE_NUM == 1 && FNR > 1 {
	a = $1 "-" $3 "-" $2
	x[a] = 1
}

FILE_NUM == 2 && FNR > 1 {
	b = $1 "-" $2 "-" $3
	if (!x[b]) {
		print b
	} else {
		print "############################## " b
	}
}