1753604 Members
6559 Online
108797 Solutions
New Discussion юеВ

Consults about ux2dos

 
SOLVED
Go to solution
Miguel Hern├бndez
Frequent Advisor

Consults about ux2dos

Hi to all:

Somebody knows why appears ^Z character at the end of the file when using ux2dos command??

I see in ASCII tables that ^Z is "subsitute"

Thanks in advance
6 REPLIES 6
renarios
Trusted Contributor

Re: Consults about ux2dos

Hi Miguel,

Can you provide some more info?

Cheers,

Renarios
Nothing is more successfull as failure
Miguel Hern├бndez
Frequent Advisor

Re: Consults about ux2dos

One example:

ad01:#more prueba
sl4knmgadf
hbsdflkhnqsg

qlklgqsdfklmg
fdgnsdnsdfgasdg pofjg4kdsmf `lkh4fg

lkfmgsaklqdmg
fdgjklnadqkfjgnsd


lkjnqagnfds

ad01:#ux2dos prueba >salida.txt

ad01:#more salida.txt
sl4knmgadf
hbsdflkhnqsg

qlklgqsdfklmg
fdgnsdnsdfgasdg pofjg4kdsmf `lkh4fg

lkfmgsaklqdmg
fdgjklnadqkfjgnsd


lkjnqagnfds
ad01:#ux2dos prueba >salida.txt
ad01:#more salida.txt
sl4knmgadf
hbsdflkhnqsg

qlklgqsdfklmg
fdgnsdnsdfgasdg pofjg4kdsmf `lkh4fg

lkfmgsaklqdmg
fdgjklnadqkfjgnsd


lkjnqagnfds
^Z


why appears ^Z??

Thanks
Pete Randall
Outstanding Contributor

Re: Consults about ux2dos

The dos and unix file formats differ in how they treat end-of-line characters and the ux2dos command is designed to make a unix file readable by Dos, as the dos2ux command is designed to make a Dos file readable by unix. Basically the two commands either add or remove end-of-line characters.

If you are seeing ^Z after each line, then you probably didn't need to convert the file - try unconverting it with dos2ux. If there is only one ^Z character at the very end of the file, that's a new one on me.


Pete

Pete
Miguel Hern├бndez
Frequent Advisor

Re: Consults about ux2dos

Hi Pete:

I see that dos2ux left ^M character at the end of the line, but this other...

Can it be problem of the terminal?
Bill Hassell
Honored Contributor
Solution

Re: Consults about ux2dos

CTRL-Z is perfectly normal for DOS ASCII files. Although MS defines (and changes) it's own standards for file formats, the basic format for ASCII files is CR+LF at the end of every line and CTRL-Z at the end of the file. You won't see the CR+LF and CTRL-Z in a Windows box as they are in the normal format. But in HP-UX, the format is not recognized by programs that use ASCII files (such as vi). If you brought over some mainframe files, the differences would be enormous.

So dos2ux and ux2dos translate ASCII files both ways. Note that CTRL-Z has been optional for many years but for backwards compatibility, ux2dos will continue to add the CTRL-Z. See this reference:

http://www.cygwin.com/ml/cygwin/1997-08/msg00189.html


Bill Hassell, sysadmin
Miguel Hern├бndez
Frequent Advisor

Re: Consults about ux2dos

Thanks Bill, that is everything what needed to know.


Thanks to all.