Skip to content

Instantly share code, notes, and snippets.

@soyo42
Created January 17, 2014 17:31
Show Gist options
  • Save soyo42/e70ab19424b91529da78 to your computer and use it in GitHub Desktop.
Save soyo42/e70ab19424b91529da78 to your computer and use it in GitHub Desktop.
explore file header - check for copyright string
#!/bin/bash
if [ -z "$1" ]; then
echo "usage:: $0 <project root folder>"
exit 1
fi
cnt=0
while read i; do
output="$(diff -u <(sed -n -e "4,7 p" "$i" | sed -r "s/\r//g") header)"
if (( $? != 0 )); then
echo "#$i"
echo "${output}"
(( cnt++ ))
fi
done < <(find -L "$1" \( -path "*/target" -or -path "*/.git" -or -path "*/third-party" \) -prune \
-or \( -type f -and \( -name '*.java' -or -name '*.xtend' \) \) | grep -v -E '(\/.git|\/target|\/third-party)$')
echo -e "\n! MISSING HEADER COUNT: ${cnt}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment