Why did they take
unix2dos away from the SLES distribution and all standard (read: supported) repositories? Honestly, I don’t know. I use it all the time. I’m pretty sure it used to be included in SLES, and it’s still in Opensuse and other distros. Ironically, the complementary
dos2unix is available in SLES as needed. Hmm…
I’m guessing that someone high up in Suse/Novell — with far more wisdom than me — decided that we needed a slightly harder-to-memorize method of day-to-day conversion of our unix files to dos than typing “
unix2dos“. So, they made sure that we have access to the more powerful and more complex “
recode” tool (which was already there anyway). So there.
So to cut to the chase, instead of typing:
…like you used to, you now get to type:
recode latin1..dos file.txt
…now let me explain. What we are doing is recoding the file from type
ISO-8859-1, a.k.a. “
Latin1“, to type
IBM-PC, a.k.a. “
dos“. As you may have figured out by now,
ISO-8859-1/Latin1 is the standard for most unix type systems. Note the two dots in between; this is the required format. To quote from the man page, “like BEFORE..AFTER, with BEFORE and AFTER being charsets”.
By the way, instead of typing “
latin1“, you could have used any of the following aliases and types that the recode utility allows:
ISO-8859-1 819/CR-LF CP819/CR-LF csISOLatin1 IBM819/CR-LF ISO8859-1 iso-ir-100 ISO_8859-1 ISO_8859-1:1987 l1 lat1 latin1 Latin-1
And, instead of typing “
dos“, you could have entered any of the following:
IBM-PC/CR-LF dos/CR-LF MSDOS/CR-LF pc/CR-LF
So there you are. You can use this tool to convert to and from almost any type. Make sure you run
recode -l to list all the types that can be recoded. And if you’re like me, you’re pretty glad that you still have this cabability… because you have scripts that export results to file on an NCP mounted volume for parsing by users with Windows and Client32, and you need to convert them to
dos format so the users can view them in good ol’ Notepad. No? You’re not like me?