Skip to content

Instantly share code, notes, and snippets.

@danielecook
Last active June 17, 2021 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielecook/b1b738d14ab4aa3d4fd36c1ee9dd3e92 to your computer and use it in GitHub Desktop.
Save danielecook/b1b738d14ab4aa3d4fd36c1ee9dd3e92 to your computer and use it in GitHub Desktop.
get header from first file and drop it from other files #tsv
# get header from first file and drop it from other files
awk 'NR == FNR || FNR > 1' *.tsv > ${output_file}
# Add a column for filename and filename column
awk -v OFS='\t' 'NR == FNR { print \$0, 'filename' } FNR > 1 { print \$0, FILENAME }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment