Last active
August 29, 2015 13:57
-
-
Save fbrundu/9810884 to your computer and use it in GitHub Desktop.
Check if a line is composed by unique words.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# line number after == | |
# change \\t with the delimiter you want to use instead of tab for splitting to words | |
words_count=$(awk 'NR==5{print}' data.csv | tr \\t \\n | wc -l) | |
unique_words_count=$(awk 'NR==5{print}' data.csv | tr \\t \\n | uniq | wc -l) | |
if [[ "$words_count" -ne "$unique_words_counts" ]]; then | |
echo "Not unique" | |
else | |
echo "Unique" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment