Skip to content

Instantly share code, notes, and snippets.

@manuzhang
Last active December 30, 2015 11:09
Show Gist options
  • Save manuzhang/7820641 to your computer and use it in GitHub Desktop.
Save manuzhang/7820641 to your computer and use it in GitHub Desktop.
calculate insertions and deletions from diff files
#!/bin/sh -
# calculate insertions
cat $1 | grep "^[+][^+].*" | egrep -v "(^[+][[:space:]]*[/]|^[+][[:space]]*[*])" | wc -l
# calculate deletions
cat $1 | grep "^[-][^-].*" | egrep -v "(^[-][[:space:]]*[/]|^[-][[:space]]*[*])" | wc -l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment