(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



Best of the Newsgroups: charconv dos windows files convert recode


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):



From: "Brian K. White" <brian@aljex.com>
References: <409f8b98$0$313$7a628cd7@news.club-internet.fr> <40a021d2$0$435$8eec23a@newsreader.tycho.net> <40A074AB.6030904@club-internet.fr> <40a078e5$0$432$8eec23a@newsreader.tycho.net> <40A242C3.5060701@club-internet.fr> 
Subject: Re: charconv like to tool ?
Date: Wed, 12 May 2004 15:59:10 -0400
Message-ID: <TZednY9MetqSHz_dRVn-jg@comcast.com> 


Frédéric STOCK wrote:
> Hello John,
>
> I used this to convert from DOS file (coming from AS400 server) to
> Unix file:
>
> charconv -i pc437 -o pc850 -D dest_file source_file
>
> now I have to convert it from Unix to DOS/Windows
>
> Thank's.
> F. STOCK



I already showed you a program that does this. I found it and built it just
for you. :)
It's called Recode.

http://www.aljex.com/bkw/sco/index.html#recode

You'll probably need to install oss646b to run the binary
You'll probably need to install groff from skunkware to read the man pages

here is the shortest recipe, assuming the unix box can see the internet and
assuming little else

first, 2 small edits of a couple files so that 3rd party binaries and man
pages will be in your path.

vi /etc/profile , add this line to the end:
  PATH=${PATH}:/usr/local/bin ; export PATH
you may need to edit the PATH= line in /.profile also, since by default
root's /.profile completely overwrites PATH with a new value, not retaining
any of what was set up during login before that point.



vi /etc/default/man , add ":/usr/local/man" to the end of MANPATH if it's
not already there
so it looks like:
  MANPATH=scohelp:/usr/man:/usr/local/man

now get the actual stuff

rftp -g -bh pcunix.com /pub/bkw setup_gnu
chmod 755 setup_gnu
./setup_gnu ftp://ftp.sco.com/pub/openserver5/oss646b/VOL.*
./setup_gnu groff-1.15
wget -q -O - http://www.aljex.com/bkw/sco/bzip2.tar.Z |zcat |tar xvf -
wget -q -O - http://www.aljex.com/bkw/sco/recode.tar.bz2 |bzcat |tar xvf -

At this point you should be able to "man recode" and
recode -f 437..850 source_file

note: it recodes the source file itself in-place.
If you don't want to lose the original file, then copy it yourself
beforehand.
cp source_file destination_file
recode -f 437..850 destination_file

It doesn't appear to do CRLF/LF translation, but oddly, it does appear to do
CRLF/CR translation. In other words it can translate between dos and mac but
not either to unix? however dtox and xtod can do that fine. so if you have a
dos file to start, you may want this to replace your previous charconv
command if it altered the line-endings.
  dtox source_file >destination_file
  recode -f 437..850 destination_file

-- 
Brian K. White  --  brian@aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani
 



Click here to add your comments





Wed Dec 17 14:44:07 2008: Subject:   TonyLawrence

gravatar
Note that "vi" can do this easily.

:set ff=unix

and then write the file, you'll convert dos or mac file endings to unix.

Of course there's :set ff=dos and :set ff=mac too.

You can be more verbose if you wish:

:set fileformat=unix

Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar



/Bofcusm/2469.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.



More:
       - OSR5
       - Bofcusm


Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress