Last Updated : 19 Jul, 2024
Sometimes, you will need to move files between windows and unix systems. Window files use the same format as Dos, where the end of line is signified by two characters, Carriage Return or
CR
or \r followed by Line Feed or
LF
or \n. Unix files, on the other hand, use only Line Feed (\n).
unix2dos
is a tool to convert line breaks in a text file from Unix format (Line feed) to DOS format (carriage return + Line feed) and vice versa.
Task : Create a file in DOS or in notepad with following contents
hello everybody
welcome to unix
unix is easy
$od –bc myfile.txt
0000000 150 145 154 154 157 040 145 166 145 162 171 142 157 144 171 015
h e l l o e v e r y b o d y \r
0000020 012 167 145 154 143 157 155 145 040 164 157 040 165 156 151 170
\n w e l c o m e t o u n i x
0000040 015 012 165 156 151 170 040 151 163 040 145 141 163 171 015 012
\r \n u n i x i s e a s y \r \n
0000060
$dos2unix myfile.txt
$od –bc myfile.txt
$unix2dos myfile.txt
$od –bc myfile.txt
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4