Skip to content

Instantly share code, notes, and snippets.

@angusdev
Created February 24, 2015 10:04
Show Gist options
  • Select an option

  • Save angusdev/c519abef5adc052b01f4 to your computer and use it in GitHub Desktop.

Select an option

Save angusdev/c519abef5adc052b01f4 to your computer and use it in GitHub Desktop.
# Find the number of occurrence of each line of file in all files from current directory
# Find the number of occurrence of each line in /path/to/file in all files from current directory
# sample ouput
# alice 0
# bob 3
# chris 14
cat /path/to/file | while read -r line ; do
echo $line `grep -src $line * | grep -v ':0$' | wc -l`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment