Skip to content

Instantly share code, notes, and snippets.

@fblundun
Created April 20, 2016 14:14
Show Gist options
  • Save fblundun/efb6b163be9f28083aec32c6f887d94f to your computer and use it in GitHub Desktop.
Save fblundun/efb6b163be9f28083aec32c6f887d94f to your computer and use it in GitHub Desktop.
Write list of filenames and line numbers corresponding to unnecessary import statements
for srcf in $(find src/main -name '*.scala'); do for lineno in $(grep -n '^import' $srcf | sed 's/:/ /g' | grep -v '{' | awk '{print $1}'); do echo $srcf $lineno; sed -i "${lineno}d" $srcf; sbt compile;if [ $? -eq 0 ]; then echo $srcf $lineno | tee -a output; fi; git checkout .; done; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment