Skip to content

Instantly share code, notes, and snippets.

@Phoenix616
Created February 13, 2018 23:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Phoenix616/d1212c6ebdff779c859aa7b8d3d9a322 to your computer and use it in GitHub Desktop.
Save Phoenix616/d1212c6ebdff779c859aa7b8d3d9a322 to your computer and use it in GitHub Desktop.
echo "File: unique (total - duplicate)"
for file in "$@"; do
for compare in "$@"; do
if [ "$file" == "$compare" ]; then
continue;
fi;
cat $compare >> /tmp/get_unique_line_count-others.txt
done;
lines=$(cat $file | wc -l)
duplicate=$(comm -12 <( sort $file ) <( sort /tmp/get_unique_line_count-others.txt ) | wc -l)
let "unique = $lines - $duplicate"
echo "$file: $unique ($lines - $duplicate)"
rm /tmp/get_unique_line_count-others.txt
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment