Dos2unix ve unix2dos kullanma cevabınız mükemmel.
İşte cevabınıza dayanan başka bir yol.
Komutları olan Gnuwin32 paketini Cygutils http://gnuwin32.sourceforge.net/packages/cygutils.htm olacak kadar eğlenceli olsa da Gnuwin32'yi kullanabilirsiniz, böylece C: \ Program Files'da unix2dos.exe ve dos2unix.exe .... \ GnuWin32 \ bin ve bunun PATH'inizde.
C:\somedir>dir<ENTER>
Volume in drive C has no label.
Volume Serial Number is DC46-3C68
Directory of C:\somedir
05/23/2014 01:10 AM <DIR> .
05/23/2014 01:10 AM <DIR> ..
05/23/2014 01:10 AM 4 file1
1 File(s) 4 bytes
3 Dir(s) 196,129,951,744 bytes free
Do this command to go from dos2unix
C:\somedir>for %f in (*) do dos2unix %f <ENTER>
C:\somedir>dos2unix file1 <-- This runs automatically from you doing the above command
file1: done.
And do this command to go from unix2dos
C:\somedir>for %f in (*) do unix2dos %f <ENTER>
C:\somedir>unix2dos file1 <-- This runs automatically from you doing the above command
file1: done.
C:\somedir>
% F değerinizin istediğinizi yapıp yapmayacağını test etmek için echo veya
@ECHO kullanın ( örn . (*) İçindeki% f için @ECHO unix2dos% f
Ve dosyaları oluşturmak ve dönüştürüldüklerini test etmek için xxd kullanabilirsiniz. Windows için xxd VIM C: \ Program "" Files \ vim \ vim74 \ xxd.exe ile birlikte gelir
so, i'll create a file, I like this style of command is it allows me to
create whateer file I want, a dos one or a unix one or anything.
61 is hex for 'a'
C:\somedir>echo 610d0a| xxd -r -p >testfile <ENTER>
check the file raw, in its hex
C:\somedir>cat testfile | xxd -p <ENTER>
610d0a
check the file in ascii or unicode
C:\somedir>cat testfile <ENTER>
a
and the following commands just prove that dos2unix and unix2dos work/are working fine.
C:\somedir>dos2unix testfile <ENTER>
testfile: done.
C:\somedir>cat testfile | xxd -p <ENTER>
610a
C:\somedir>unix2dos testfile <ENTER>
testfile: done.
C:\somedir>cat testfile | xxd -p <ENTER>
610d0a
C:\somedir>
not - ayrıca bir * nix dağıtımının kullanılması durumunda, apt-get (apt-cache search dos2unix) 'e bakıldığında paket gerçekten (belki de şaşırtıcı olmayan bir şekilde!) dos2unix (apt-get install dos2unix ile kurulur) ve dos2unix ile birlikte gelir yürütülebilir, unix2dos yürütülebilir. Eğer apt-cache arama unix2dos yaparsanız, dos2unix paketini gösterir.