Skip to content

Instantly share code, notes, and snippets.

@kylekellogg
Created April 4, 2014 05:04
Show Gist options
  • Save kylekellogg/9968494 to your computer and use it in GitHub Desktop.
Save kylekellogg/9968494 to your computer and use it in GitHub Desktop.
Recursive sed based solution for converting line endings from Unix to DOS format
#!/usr/bin/env bash
for /r %%i in (*) do (
pushd "%%i"
for /f in (dir /b * 2^>nul) do (
# Something similar to the above using this below sed command
if [[ -f $file ]]
then
#sed "s/$//"
echo "Converting $file"
else
echo "Skipping $file"
fi
)
popd
)
#!/usr/bin/env bash
for file in $(find . -type f -path "./*")
do
if [[ -f $file ]]
then
#sed 's/.$//' $file
echo "Converting $file"
else
echo "Skipping $file"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment