Wednesday, September 12, 2007

UNIX to DOS text file format converter

Twelve years ago, I was creating a simple C++ program, as part of a job request, to convert a unix text file into a DOS text file format readable by some banks' data processing department.

Yes, here's an obsolete blog entry, but still would post it here before this linux binary command that does the same job would be phased out sooner or later.

This is a quick linux blog entry convering unix to dos file converter.

UNIX2DOS INSTALLATION
=====================

My current box has it, but if you wish to install unix2dos file converter, you can do so

# yum -y unix2dos

UNIX2DOS USAGE
==============

# unix2dos input.txt output.txt

Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode.

# unix2dos a.txt -c iso b.txt

# unix2dos -c ascii a.txt -c iso

Convert and replace a.txt while keeping original date stamp.

# unix2dos -k a.txt

# unix2dos -k -o a.txt

Convert a.txt and write to e.txt.

# unix2dos -n a.txt e.txt

Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt.

# unix2dos -k -n a.txt e.txt

Convert and replace a.txt. Convert b.txt and write to e.txt.

# unix2dos a.txt -n b.txt e.txt
# unix2dos -o a.txt -n b.txt e.txt

Convert c.txt and write to e.txt. Convert and replace a.txt. Convert and replace b.txt. Convert d.txt and write to f.txt.

# unix2dos -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt

Done.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy