Skip to content

Instantly share code, notes, and snippets.

@emres
Created December 18, 2011 22:08
Show Gist options
  • Save emres/1494637 to your computer and use it in GitHub Desktop.
Save emres/1494637 to your computer and use it in GitHub Desktop.
Language detection in Bash command line (for German)
en_res=$(echo $(cat some_de.txt EN | gzip | wc -c) - $(gzip -c EN | wc -c) | bc); \
de_res=$(echo $(cat some_de.txt DE | gzip | wc -c) - $(gzip -c DE | wc -c) | bc); \
(echo $en_res EN && echo $de_res DE) | sort -n | head -1 | cut -d' ' -f2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment