Unix to linux migration - unix2dos
NickName:Sachin Ask DateTime:2012-05-24T03:52:27

Unix to linux migration - unix2dos

I am migrating my code from UNIX to LINUX and I know unix2dos command is not available in SUSE 11.0. Please let me know if

alias unix2dos='recode lat1..ibmpc'

will have the same effect as that of unix2dos?

Copyright Notice:Content Author:「Sachin」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/10726879/unix-to-linux-migration-unix2dos

Answers
Tim Pote 2012-05-23T19:57:58

I'm not sure about recode, but sed -i 's/$/\\r/' would do the same thing as unix2dos.",


Michał Kosmulski 2012-05-23T22:09:13

Using recode seems risky, it's used for converting character sets, not just changing newline characters. I haven't used recode but I'm afraid that you could break your files if they are encoded in e.g. UTF-8 instead of Latin1.\n\nI don't know what packages are found in SUSE, but perhaps there is one of the alternatives to unix2dos, like todos (on Debian found in package tofromdos).\n\nUsing sed as other suggested should work well. If you are really worried about performance, you could compare sed's performance to awk '{print $0 \"\\r\"}' - I can't say for sure which will be faster in your case but it won't hurt to measure both on a sample of your files.",


More about “Unix to linux migration - unix2dos” related questions

Unix to linux migration - unix2dos

I am migrating my code from UNIX to LINUX and I know unix2dos command is not available in SUSE 11.0. Please let me know if alias unix2dos='recode lat1..ibmpc' will have the same effect as that of

Show Detail

unix2dos equivalent in linux

I am planning to migrate my application coded in C/C++ and running on UNIX to Linux Suse 11.1. I have some places where unix2dos is used. I knew that flip is alternative to unix2dos in linux. Pleas...

Show Detail

UNIX2DOS Functionality

/bin/ksh -c "cat $PMSourceFileDir/RT/TgtFiles/$OutputFileStrPerfHdr $PMSourceFileDir/RT/TgtFiles/$OutputFileStrPerfCSV | unix2dos -437 > $PMRootDir/RT/Temp/$OutputFileStrPerfCSV" I work in IBM

Show Detail

unix2dos (or dos2unix) in ant

How do I do unix2dos (or dos2unix) with ant. I.e. I want to change the newlines from linux newlines (if any) to dos newlines

Show Detail

Problems when trying to exectue exec("unix2dos xxx") in PHP/Apache

In a previous post, I was trying to update the encoding for a download file from php. One of the suggestions was to run the unix2dos command before sending the file to the user. This works great ...

Show Detail

for loop / unix2dos to clean a group of files with specific extension

I am trying to use unix2dos on a group of C++ source code files. Basically, unix2dos converts LF to CRLF. I could simply do the following, and it does what I want : #!/bin/sh find . -type f \( -n...

Show Detail

unix2dos command failed because of ^@ symbol present in the file

I'm facing below issue when performing unix2dos conversion unix2dos: Binary symbol found at line 166 unix2dos: Skipping binary file Sample.txt I can find ^@ characters in the file. I can do -f whi...

Show Detail

How to apply unix2dos on last modified file?

Ok, so I have a few files in my directory which follows the following pattern: TEST_20150130.txt TEST_20150202.txt TEST_20150203.txt TEST_20150204.txt TEST_RESULT_20150130.csv TEST_RESULT_20150202...

Show Detail

Informix database from unix to Linux

We are going to migrate .net applications with Informix database as datasource systems from Unix to Linux server. The informix databases are available in the existing Unix server. As part of imp...

Show Detail

Run the command unix2dos <file_path> and to make sure I opened the file but it doesn't show me ^M any reason

I run the command unix2dos &lt;file_path&gt; and to make sure I opened the file but it doesn't show me ^M. can anyone tell me the reason? I want to run some command to copy some text to another file

Show Detail