Skip to content

Instantly share code, notes, and snippets.

@sparkida
Last active March 29, 2018 10:32
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sparkida/7773170 to your computer and use it in GitHub Desktop.
Save sparkida/7773170 to your computer and use it in GitHub Desktop.
First, find all files in current directory with the extension ".php" and remove all "^M" ^M = Ctrl+V + Ctrl+M (don't just type the caret "^" symbol and M...they are not the same :/ )
#!/bin/bash
#Find and replace all files with ^M (dos format) to Unix format.
find $(pwd) -type f -name "*.php" | while read file; do sed -e 's/^M//g' -i "$file"; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment