Skip to content

Instantly share code, notes, and snippets.

@tonyseek
Last active July 21, 2018 08:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonyseek/4fdd46dce284ee8f9d9f20aa58c17b20 to your computer and use it in GitHub Desktop.
Save tonyseek/4fdd46dce284ee8f9d9f20aa58c17b20 to your computer and use it in GitHub Desktop.
Remove wild control characters from files which was edited by VSCode
#!/usr/bin/env sh
# Clean up the control characters of documents
# See also: https://wdd.js.org/vscode-control-characters-problem.html
# https://github.com/Microsoft/vscode/issues/37114
exec find . -type f -name '*.md' -exec perl -pi -e 's/[\x{0000}\x{0001}\x{0002}\x{0003}\x{0004}\x{0005}\x{0006}\x{0007}\x{0008}\x{000b}\x{000c}\x{000d}\x{000e}\x{000f}\x{0010}\x{0011}\x{0012}\x{0013}\x{0014}\x{0015}\x{0016}\x{0017}\x{0018}\x{0019}\x{001a}\x{001b}\x{001c}\x{001d}\x{001e}\x{001f}\x{001c}\x{007f}]//gm' {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment