Skip to content

Instantly share code, notes, and snippets.

@tyxla
Created October 4, 2017 07:14
Show Gist options
  • Save tyxla/1685d1a60595ab6bd717abbafa3368e4 to your computer and use it in GitHub Desktop.
Save tyxla/1685d1a60595ab6bd717abbafa3368e4 to your computer and use it in GitHub Desktop.
Remove empty lines between ES6 imports recursively in a directory (using multiline regex find and replace with perl)
find . -type f -exec perl -0777 -i -p -e 's/(import[^\n\r]+)[\n\r]{2,}(import[^\n\r]+)/\1\n\2/igs' {} +
@tyxla
Copy link
Author

tyxla commented Oct 4, 2017

If you're getting the "illegal byte sequence" error, you might want to type the following commands in your console first:

LANG=C
LC_CTYPE=C

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