Skip to content

Instantly share code, notes, and snippets.

@g4s8
Created February 21, 2021 08:54
Show Gist options
  • Save g4s8/a6eb27a6e333c7c8ec641eb8ee02822e to your computer and use it in GitHub Desktop.
Save g4s8/a6eb27a6e333c7c8ec641eb8ee02822e to your computer and use it in GitHub Desktop.
Script for replacing license headers in all java files
#!/bin/bash
set -e
for j in $(find $PWD -type f -name '*.java'); do
sed -i '/^\/\*/{:a;N;/\*\//!ba};/MIT License/d' $j
echo "removed old license: $j"
rm -f tmp
cp $1 tmp
cat $j >> tmp
rm $j
mv tmp $j
echo "added new license: $j"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment