• Home
  • Convert DOS to UNIX and vice versa

Convert DOS to UNIX and vice versa

25 May 2019 Bajrang Gupta Comments Off

The awk command

The awk command also lets you convert a file from UNIX to Windows and vice versa. To convert a Windows file to a UNIX file, enter the following command:
awk '{ sub("\r$", ""); print }' windows.txt > unix.txt
To convert a UNIX text file called “unix.txt” to a Windows text file called “windows.txt”, enter the following command:
awk 'sub("$", "\r")' uniz.txt > windows.txt