Skip to content

Instantly share code, notes, and snippets.

@nievergeltlab
Last active June 29, 2021 21:35
Show Gist options
  • Save nievergeltlab/2d797a1ae138b342782ba84c5222780c to your computer and use it in GitHub Desktop.
Save nievergeltlab/2d797a1ae138b342782ba84c5222780c to your computer and use it in GitHub Desktop.
Join two files using the join command. Adjust for localization issues that cause improper sorting.
LC_ALL=C sort -k1b,1 file1.txt > file1.txt.sorted
LC_ALL=C sort -k1b,1 file2.txt > file2.txt.sorted
LC_ALL=C join file1.txt.sorted file2.txt.sorted > joined.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment