![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
I can't believe I don't know how to do this, but I don't know of an easy way to convert all of the files in a directory from dos linefeeds to unix ones. Surely there's a one-liner for this.
|
|
||||
![]()
You have a several choices. There is a port called dos2unix or you can use commands listed in this site:
http://www.vasudevaservice.com/docum...nix_text_files
__________________
The power of plain text? It can control an entire OS |
|
|||
![]()
Hello,
There are two utilities for Unix systems that takes care of this issue. One is called unix2dos and the other is dos2unix. Some Unix systems include them in the base, some don't (but they are readily available on the internet if your system doesn't include them).
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
![]()
Hello,
Looks like 18Googol2 beat me to it! ![]()
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
![]()
I usually use Perl but you can count on sed and awk being in every BSD, perl, unix2dos, and dos2unix on the other hand not so much.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
![]()
Here are one-liner functions I keep in my .shrc so I don't need to install dos2unix on each new machine:
dos2unix() { awk "{ sub(\"\r\$\", \"\"); print }" $1 > $2; } unix2dos() { awk "sub(\"\$\", \"\r\")" $1 > $2; } |
|
|||
![]()
For a single file:
Code:
$ tr -d '\r' <file_with_CRLF >file_without_CR ![]()
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
Thanks J65nko, I was just about to ask why no was was showing any love for tr. It's very handy.
|
|
|||
![]()
I just noticed that nvi doesn't handle dos line endings very well.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
![]() |
Tags |
dos unix linefeeds |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unix Popularity | ninjatux | Off-Topic | 147 | 21st January 2014 09:49 PM |
College, Unix, and careers! | bsdsys_x86 | Off-Topic | 8 | 18th October 2008 09:59 PM |
How have you guys learned Unix administration? | bigb89 | Off-Topic | 13 | 11th July 2008 03:40 PM |
a tour through UNIX sources | Oliver_H | Off-Topic | 2 | 25th June 2008 08:37 PM |
Recommendation of the UNIX.COM Forums | vermaden | Off-Topic | 53 | 24th June 2008 07:01 PM |