Sponsored Content
Top Forums Shell Programming and Scripting Mail/mailx ignores newline formatting Problem. Post 302985275 by Don Cragun on Monday 7th of November 2016 09:31:36 PM
Old 11-07-2016
As was stated repeatedly in your previous thread, cat, mail, mailx, and sendmail do not ignore <newline> characters.

If the people to whom you are sending mail are using mail readers that assumes that all text is HTML, that might be what is changing your <newline>s to <space>s. But I have never seen anything that does what you say is happening.

Unless you have replaced the cat, mail or mailx, and sendmail utilities that were loaded when you installed your BSD, Linux, or UNIX operating system and associated utilities; we all know that none of those utilities is ignoring <newline> characters. Any thread that you start that says otherwise is wasting our time.
These 4 Users Gave Thanks to Don Cragun For This Post:
 

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
fmt(1)							      General Commands Manual							    fmt(1)

NAME
fmt - Formats mail messages prior to sending SYNOPSIS
fmt [-width] file... DESCRIPTION
The fmt command reads the input file or files, or standard input if no files are specified, and writes to standard output a version of the input with lines of a length as close as possible to width columns. (Because fmt is internationalized software, the number of display col- umns is not necessarily equivalent to the number of bytes.) The fmt command both joins and splits lines to achieve the desired width, but words are never joined or split; spaces are always preserved, and lines are split at spaces only. In effect, fmt ignores newline characters in the input and wraps words to make lines a close as possi- ble to width columns, resulting in individual lines of varying length but a consistent (new) text width overall. Because blank lines are always preserved, fmt does not merge paragraphs separated by blank lines. If you specify more than one file, the files are concatenated as input to fmt. If you do not specify -width, the default line length is 72 columns. Spacing at the beginning of input lines is always preserved in the output. The fmt command is generally used to format mail messages to improve their appearance before they are sent. It may also be useful, how- ever, for other simple formatting tasks. For example, when you are using vi, you can use the command :%!fmt -60 to reformat your text so that all lines are approximately 60 columns long. NOTES
The fmt command is a fast, simple formatting program. Standard text editing programs are more appropriate than fmt for complex formatting operations. Do not use the fmt command if the message contains embedded messages or preformatted information from other files. This com- mand formats the heading information in embedded messages and may change the format of preformatted information. EXAMPLES
file1 contains these lines: Australia is an island-continent, home to many very interesting plants and animals. To reformat this text to a narrower width, enter: fmt -30 file1 This results in the following, displayed on your screen: Australia is an island-continent, home to many very interesting plants and animals. To make file1 wider, enter: fmt -60 file1 This results in: Australia is an island-continent, home to many very interesting plants and animals. To format a message you have created with the mailx editor, at the left margin enter: ~|fmt After you enter the command, your message is formatted, in this case to the default line length of 72 columns, and the word continue is displayed to indicate that you can enter more information or send your message. SEE ALSO
Commands: mail(1), mailx(1), vi(1) fmt(1)
All times are GMT -4. The time now is 03:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy