Print Table File Field Info

Given a delimited table file with the first row being field (column) names, print the field names as a list: awk 'NR==1{for (i=1;i<=NF;i++) print $i}' file.tsv With numbering: awk -F '\t' 'NR==1{for (i=1;i<=NF;i++) printf("%02d: %s\n", i, $i)}' file.

Read more

Merge Multiple Files With Header Rows

AWK / BASH one-liner to merge multiple files skipping the first row of each file except the first file, skipping blank lines (useful for concatenating table/data files where the first row is a header): awk 'NF==0 || (FNR==1 && NR!=1){next;}{print}' file1.txt file2.txt .

Read more