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.tsv
Share