Created
March 10, 2012 18:03
-
-
Save jappy/2012320 to your computer and use it in GitHub Desktop.
Shell script to convert files with CRLF to LF (Mac/Linux)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
for x | |
do | |
echo "Converting $x" | |
tr -d '\015' < "$x" > "tmp.$x" | |
mv "tmp.$x" "$x" | |
done |
uded
commented
Dec 13, 2018
Some problem with script...
./dos2unix.sh: line 6: tmp.filename.js: No such file or directory
It appears the script can't find your file 'tmp.filename.js'. Is it in your
local directory where the script is?
…On Wed, Nov 27, 2019 at 2:05 AM Aleksey Makas ***@***.***> wrote:
Some problem with script...
./dos2unix.sh: line 6: tmp.filename.js: No such file or directory
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://gist.github.com/2012320?email_source=notifications&email_token=AAEX7WISL3XRZDLH72AS42LQVYL2PA5CNFSM4JSCMH2KYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF43RU#gistcomment-3094298>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEX7WKKOPFVIMLU77FJWHDQVYL2PANCNFSM4JSCMH2A>
.
tr -d '\015' < "$x" > "tmp.$x"
Will script create this tmp file? Will I need to create this tmp file by myself?
tr -d '\015' < "$x" > "tmp.$x"
Will script create this tmp file? Will I need to create this tmp file by myself?
This script makes tmp file and overwrite original file. You don't need to do anything.
Thanks for sharing this!!!!
I was having some issues with the tmp file not being found. I ended up contacting the string and then run the code. Here is what I ended up doing in the end.
for x
do
echo "Converting $x"
temp_file+="tmp."$x
tr -d '\015' < "$x" > temp_file
mv temp_file "$x"
done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment