Skip to content

Instantly share code, notes, and snippets.

@fabien7337
Last active August 29, 2015 14:07
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 fabien7337/cee23c6a7682b2e07515 to your computer and use it in GitHub Desktop.
Save fabien7337/cee23c6a7682b2e07515 to your computer and use it in GitHub Desktop.
Useful to compare a file line by line: for example to extract lines that are in file1 but not in file2
#!/bin/sh
while read line_file1
do
answered=$(cat file2| grep $line_file1)
if [ -z "$answered" ]; then
echo $line_file1
fi
done < file1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment