Skip to content

Instantly share code, notes, and snippets.

@keuv-grvl
Last active February 3, 2017 17:37
Show Gist options
  • Save keuv-grvl/dbbf66e58555652c63ed73b3d22c425e to your computer and use it in GitHub Desktop.
Save keuv-grvl/dbbf66e58555652c63ed73b3d22c425e to your computer and use it in GitHub Desktop.
Join multiple files by their first columns
# usage: join_rec file1.tsv file2.tsv file3.tsv file*.tsv
# do not try to join 23k files...
function join_rec {
f1=$1; f2=$2;
shift 2;
if [ $# -gt 0 ]; then
join -a1 -a2 -e 0 -o auto -t$'\t' "$f1" "$f2" | join_rec - "$@" ;
else
join -a1 -a2 -e 0 -o auto -t$'\t' "$f1" "$f2" ;
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment