Skip to content

Instantly share code, notes, and snippets.

@flobaader
Last active January 7, 2018 21:20
Show Gist options
  • Save flobaader/326e9aa875b59fae873e6f34474f2cf8 to your computer and use it in GitHub Desktop.
Save flobaader/326e9aa875b59fae873e6f34474f2cf8 to your computer and use it in GitHub Desktop.
Removes all local package declarations and imports
#!/bin/bash
package="pgdp"
mkdir temp
#Copy all files to temp
find . -iname '*.java' -exec cp -rf --target-directory temp/ {} \;
cd temp
#Replace all package related lines
find . -type f -print0 | xargs -0 sed -i "/${package}/d"

Removes all package declarations and imports from all .*java files in the current directory and copies them to a temp folder

Just replace package with your root package name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment