Skip to content

Instantly share code, notes, and snippets.

@dedunumax
Last active June 24, 2023 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dedunumax/38fc581d337df9b442f4bffce3960492 to your computer and use it in GitHub Desktop.
Save dedunumax/38fc581d337df9b442f4bffce3960492 to your computer and use it in GitHub Desktop.
#!/bin/bash
printf 'a\na\nb\nc\nd\nd' > file1
printf 'b\nd' > file2
echo 'Test Case 1, without sort command:'
grep -F -f file2 -v file1 | uniq
echo 'Test Case 1, with sort command:'
grep -F -f file2 -v file1 | sort |uniq
printf 'a\na\nb\nc\na\nd\nd' > file1
printf 'b\nd' > file2
echo 'Test Case 2, without sort command:'
grep -F -f file2 -v file1 | uniq
echo 'Test Case 2, with sort command:'
grep -F -f file2 -v file1 | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment