Sponsored Content
Top Forums Shell Programming and Scripting Mail/mailx ignores newline formatting Problem. Post 302985222 by mohtashims on Monday 7th of November 2016 11:33:05 AM
Old 11-07-2016
Mail/mailx ignores newline formatting Problem.

I have a file hello.txt which i wish to send as a email body (not attachment).

Code:
cat -ev hello.txt
1$
2$
3$

I use the following command to send the hello.txt as the email body.

Code:
mailx -s "Alert" myteam@mycomp.com<hello.txt

However, the email received has this in the email body
Code:
123

instead of
Quote:
1
2
3
So, you can see that the newline is not considered in the email body.

hello.txt was created using the below command
Code:
echo "1\n">>hello.txt
echo "2\n">>hello.txt
echo "3\n">>hello.txt

i do not find unix2dos, ux2dos ,perl or uuencode on my System.

Code:
uname -a
Linux mymac 3.10.0-327.36.1.el7.x86_64 #1 SMP Wed Aug 17 03:02:37 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Please suggest a solution.

Last edited by mohtashims; 11-07-2016 at 09:16 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatting a text file based on newline and delimiter characters

Hi Everybody, I need some help on formatting the files coming into unix box on the fly. I get a file some thing like this in a single line. ISA^M00^M ^M00^M ^M14^M006929681900 ^M01^M095449419 ... (5 Replies)
Discussion started by: ntekupal
5 Replies

2. UNIX for Advanced & Expert Users

mailx commannd - Mail and Attachment in same mail

Hi , I am using mailx command for sending the mails. Rightnow I am sending the attachment (by using uuencode $filename) as a seperate mail.I wanna send the attachment also with the same mail. (6 Replies)
Discussion started by: sharif
6 Replies

3. Shell Programming and Scripting

Problem with Mailx command to send mail with attachment

Hi, I am using mailx command to send a mail with attachment. It's working fine, but with attachment I am getting one extra attachment like (ATT00131.txt). I have tried to use unix2dos command also. But still I am getting the extra attachment. I am using the following code: subject="temp... (5 Replies)
Discussion started by: viswanatharv
5 Replies

4. Shell Programming and Scripting

Problem using mailx instead of mail in perl program

I have a perl program that uses the mail program to send emails. It works fine but because I want to change the return address on the emails to be different I need to use mailx with the "-r" option. the problem is when I change this line to use mailx I no longer recieve "any" emails. This works... (1 Reply)
Discussion started by: kieranfoley
1 Replies

5. UNIX for Dummies Questions & Answers

formatting data to remove newline

Hi All, I have raw data in the format :- -------------------------------------------------------------------- NUT070 3 ./opc.sh SQLSCRIPT &SID sysdate.sql 20120105 NUW004 3 ./opc.sh SQLSCRIPT &SID sab_supp.sql UNUW032 3 ./opc.sh SQLSCRIPT &SID sab_unsupp.sql... (3 Replies)
Discussion started by: subhotech
3 Replies

6. UNIX for Dummies Questions & Answers

Formatting not preserved when using mailx

I tried to send email through mailx, the text file is well formatted when i open in unix, but when received the mail in outlook, the column do not align with the heading. The text file contain the tablespace details which I spool out from database. Please advise. Do I need to specify any parameter... (4 Replies)
Discussion started by: fenocean
4 Replies

7. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

8. UNIX for Dummies Questions & Answers

Problem getting mailx to send true Bcc mail to multiple recipients

I am having trouble getting mailx to send multiple Bcc mails out without everyone in the list of recipients seeing everyone else's email addresses. I looked at the man pages of my system and seem to be following the syntax correctly, but the mails still go out as if I were just putting in a list of... (7 Replies)
Discussion started by: legrandtimonier
7 Replies

9. Shell Programming and Scripting

Formatting for mailx command

Hello all, I am trying to send an email using mailx command. I have a txt file which has formatting like: root@machine# cat /export/home/test/summary.txt T A P O U T - R A T I N G - A U D I T - S U M M A R Y - R E P O... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

10. Shell Programming and Scripting

Mailx appending exclamation mark and newline in a long line

Hi, I have a shell script which automates reporting and at times, requires the report line to be very long (sometimes as long as 2131 chars). The output I get is similar to this: XXXX XXXXXXX 16:15 3.24% 5.07% 3.69% 5.23% 3.68% 4.06% 3.57% 5.03% 4.31% 5.11% 3.49% 4.19% 4.31% ... (2 Replies)
Discussion started by: gilberteu
2 Replies
dos2unix(1)						      General Commands Manual						       dos2unix(1)

NAME
dos2unix - DOS/MAC to UNIX text file format converter SYNOPSYS
dos2unix [options] [-c convmode] [-o file ...] [-n infile outfile ...] Options: [-hkqV] [--help] [--keepdate] [--quiet] [--version] DESCRIPTION
This manual page documents dos2unix, the program that converts plain text files in DOS/MAC format to UNIX format. OPTIONS
The following options are available: -h --help Print online help. -k --keepdate Keep the date stamp of output file same as input file. -q --quiet Quiet mode. Suppress all warning and messages. -V --version Prints version information. -c --convmode convmode Sets conversion mode. Simulates dos2unix under SunOS. -o --oldfile file ... Old file mode. Convert the file and write output to it. The program default to run in this mode. Wildcard names may be used. -n --newfile infile outfile ... New file mode. Convert the infile and write output to outfile. File names must be given in pairs and wildcard names should NOT be used or you WILL lost your files. EXAMPLES
Get input from stdin and write output to stdout. dos2unix Convert and replace a.txt. Convert and replace b.txt. dos2unix a.txt b.txt dos2unix -o a.txt b.txt Convert and replace a.txt in ASCII conversion mode. Convert and replace b.txt in ISO conversion mode. Convert c.txt from Mac to Unix ascii format. dos2unix a.txt -c iso b.txt dos2unix -c ascii a.txt -c iso b.txt dos2unix -c mac a.txt b.txt Convert and replace a.txt while keeping original date stamp. dos2unix -k a.txt dos2unix -k -o a.txt Convert a.txt and write to e.txt. dos2unix -n a.txt e.txt Convert a.txt and write to e.txt, keep date stamp of e.txt same as a.txt. dos2unix -k -n a.txt e.txt Convert and replace a.txt. Convert b.txt and write to e.txt. dos2unix a.txt -n b.txt e.txt dos2unix -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. dos2unix -n c.txt e.txt -o a.txt b.txt -n d.txt f.txt DIAGNOSTICS
BUGS
The program does not work properly under MSDOS in stdio processing mode. If you know why is that so, please tell me. AUTHORS
Benjamin Lin - <blin@socs.uts.edu.au> Bernd Johannes Wuebben (mac2unix mode) <wuebben@kde.org> MISCELLANY
Tested environment: Linux 1.2.0 with GNU C 2.5.8 SunOS 4.1.3 with GNU C 2.6.3 MS-DOS 6.20 with Borland C++ 4.02 Suggestions and bug reports are welcome. SEE ALSO
unix2dos(1) mac2unix(1) 1995.03.31 dos2unix v3.0 dos2unix(1)
All times are GMT -4. The time now is 06:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy