Skip to content

Instantly share code, notes, and snippets.

@sachsgit
Created November 18, 2021 16:06
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 sachsgit/7819c2b5423d72c344f3deed955e6e45 to your computer and use it in GitHub Desktop.
Save sachsgit/7819c2b5423d72c344f3deed955e6e45 to your computer and use it in GitHub Desktop.
UNIX `find` command to find all files to apply the `dos2unix` command on them
#!/bin/bash
find . -type f \
\( -not -path "*/.git/*" \
-and -not -path "*/target/*" \
-and -not -path "*/.metadata/*" \
-and -not -path "*/.sonar*/*" \) \
-exec grep -Iq . {} \; \
-exec grep -U $'\015' {} \; \
-exec dos2unix {} \; \
-print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment