Reputation: 477
I have two command line with AWK which works perfectly independently:
awk 'FNR < 2' DATA #parse out first line from DATA
awk 'NR==FNR{a[$1]=$1; next} a[$1]' LIST DATA #parse the matched elements between LIST and DATA
I need to parse first line for DATA as well as the matched elements between LIST and DATA in one output.
Any suggestions please.
Upvotes: 0
Views: 214
Reputation: 195289
based on your current codes:
awk 'NR==FNR{a[$1]=$1; next} FNR<2||a[$1]' LIST DATA
Upvotes: 2