mailx text files lost CR-Character (380 Views)
Reply
Frequent Advisor
Posts: 98
Registered: ‎11-02-2003
Message 1 of 11 (380 Views)

mailx text files lost CR-Character

Hi,

I create a text file with tail -20 /var/adm/syslog/syslog.log > textfile. If i look in the file is evething ok, text appears as on the screen.
If I send it with mailx (pg textfile > mailx ...), the text appears in the mail of only one line, without Carriage Returns ! Also not easy to read it. I's the same with more > mailx.
Any idea ?
Thank you.
Thierry
Valued Contributor
Posts: 187
Registered: ‎04-07-2005
Message 2 of 11 (380 Views)

Re: mailx text files lost CR-Character

Which type of computer do you read the received e-mail ? Windows ? Mac ? Unix ?
Outstanding Contributor
Posts: 16,207
Registered: ‎11-03-1996
Message 3 of 11 (380 Views)

Re: mailx text files lost CR-Character

Try "dos2ux textfile > mailx"


Pete

Pete
Honored Contributor
Posts: 5,920
Registered: ‎03-21-2002
Message 4 of 11 (380 Views)

Re: mailx text files lost CR-Character

man dos2ux and ux2dos
There is no substitute to HARDWORK
Honored Contributor
Posts: 4,030
Registered: ‎06-09-2004
Message 5 of 11 (380 Views)

Re: mailx text files lost CR-Character

You have to change file encoding type with dos2ux utility.

dos2ux file > dosfile
ps dosfile > mailx

hth.
Easy to suggest when don't know about the problem!
Acclaimed Contributor
Posts: 21,184
Registered: ‎07-06-2000
Message 6 of 11 (380 Views)

Re: mailx text files lost CR-Character

Hi Thierry:

If you are moving a file from UNIX to Windows, you need to replace newline (LF) characters as line-delimiters with carriage-return (CR) + newline (LF) ones.

On HP-UX you have:

'ux2dos' and 'dos2ux'

See the manpage for 'ux2dos'.

The first adds the CR. The second strips it out.

Regards!

...JRF...
Frequent Advisor
Posts: 98
Registered: ‎11-02-2003
Message 7 of 11 (380 Views)

Re: mailx text files lost CR-Character

umh ... sorry for the trouble ...

It was not better with ux2dos/dos2ux, but ...

i found an option in ... Outlook. In extras > Options > Email options > remove extra line breaks (or something else, i have an german MS Office version).

Now it's good.

Thank you for your help.

Thierry
Honored Contributor
Posts: 1,546
Registered: ‎08-25-2003
Message 8 of 11 (380 Views)

Re: mailx text files lost CR-Character

Outlook 2003 has had a change where it will actively strip out what it considers to be 'unnecessary' line breaks.

dos2ux should help, otherwise You could uuencode the text.
yesterday I stood at the edge. Today I'm one step ahead.
Honored Contributor
Posts: 1,546
Registered: ‎08-25-2003
Message 9 of 11 (380 Views)

Re: mailx text files lost CR-Character

Hey - now You solved my problem instead of the other way round ;)
yesterday I stood at the edge. Today I'm one step ahead.
Frequent Advisor
Posts: 61
Registered: ‎06-21-2004
Message 10 of 11 (380 Views)

Re: mailx text files lost CR-Character

Oddly enough just did this - wanted it as an attachment instead of in line (file bad 70,000 lines).

On my HP-UX server:
ux2dos originalfile >newfile
uuencode newfile |mailx -s "Newfile you wanted" -r myaddress@mydomain myaddress@mydomain

The ux2dos adds the exta carriage retrun needed for DOS/Windows ASCII (you'll see this as a "^M" at the end of every line if you vi the file in HP-UX.

The uuencode prevents it from being parsed by the mailer - just goes in as an attachment to the mail.

mailx options:
-s Specifies the subject
-r Specifies the return address the recipient will see (otherwise if you do it as root they'll see return as root@hostname.domain)
Honored Contributor
Posts: 1,546
Registered: ‎08-25-2003
Message 11 of 11 (380 Views)

Re: mailx text files lost CR-Character

If You uuencode the file, You don't need dos2ux anymore - uuencode is a host-independent data format. :)
yesterday I stood at the edge. Today I'm one step ahead.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.