Mailx appending exclamation mark and newline in a long line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mailx appending exclamation mark and newline in a long line
# 1  
Old 03-06-2017
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:

Code:
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%  4.78%  3.97%  4.85%  4.17%  4.95%  3.45%  4.55%  4.00%  4.95%  3.01%  4.63%  3.21%  4.83%  3.73%  4.57%  3.98%  4.62%  3.56%  4.84%  3.67%  5.33%  2.99%  5.54%  4.74%  4.65%  3.58%  4.83%  3.98%  4.50%  3.62%  5.43%  3.41%  5.32%  3.41%  3.56%  3.80%  4.75%  3.70%  4.94%  3.58%  5.19%  3.65%  4.16%  4.36%  4.98%  4.34%  4.50%  3.03%  4.98%  4.13%  4.67%  4.18%  4.91%  3.60%  4.54%  4.30%  4.91%  3.91%  4.75%  3.95%  5.43%  3.77%  5.47%  3.63%  4.18%  4.34%  4.37%  3.22%  5.64%  3.59%  5.45%  3.21%  4.74%  4.33%  4.46%  4.73%  4.87%  4.37%  4.94%  4.12%  4.15%  3.87%  4.67%  3.36%  5.39%  3.55%  4.70%  3.05%  4.56%  4.04%  5.46%  4.55%  4.92%  3.12%  4.68%  3.61%  5.09%  2.97%  4.28%  3.34%  4.86%  3.98%  4.71%  3.98%  5.68%  3.42%  4.96%  3.49%  4.30%  3.77%  5.13%  3.68%  4.60%  3.48%  4.42%  3.10%  4.64%  4.18%  6.03%  2.72%  5.25%  4.07%  4.77%  3.75%  4.37%  3.64!
 %  4.72%  3.48%  4.56%  3.28%  5.15%  3.71%  4.84%  3.05%  4.66%  3.15%  5.09%  3.54%  5.24%  3.76%  4.74%  3.35%  4.57%  4.35%  4.83%  3.53%  4.86%  3.14%  4.96%  3.56%  4.89%  2.95%  5.25%  3.58%  5.14%  3.14%  4.06%  3.23%  4.65%  3.12%  4.50%  4.20%  5.24%  4.02%  5.02%  4.34%  5.06%  3.33%  6.26%  3.42%  4.36%  3.22%  4.93%  3.80%  5.09%  3.49%  4.89%  2.74%  5.53%  4.18%  5.59%  3.77%  5.21%  3.68%  5.25%  3.19%  4.32%  2.96%  4.88%  4.23%  5.25%  3.38%  4.48%  3.47%  4.88%  4.59%  5.40%  3.23%  4.80%  3.11%  5.87%  3.24%  4.40%  4.17%  3.57%  3.75%  4.53%  3.51%  5.36%  3.61%  5.74%  3.64%  4.97%  3.66%  4.89%  3.79%  6.17%  4.06%  4.50%  3.66%  3.92%  3.25%  4.71%  3.24%  4.65%  3.22%  4.99%  3.13%  4.75%  4.00%  5.27%  3.81%  4.19%  3.54%  4.48%  4.03%  4.47%  3.73%  4.81%  3.26%  4.76%  3.33%  5.28%  3.25%  5.30%  3.52%  5.45%  3.28%  6.77%  3.34%  5.10%  3.24%  5.35%  3.22%  3.93%  3.71%  5.03%  3.96%  4.19%  3.87%  5.01%  3.50%  4.29%  3.67%  4.73%  3.96%  4.82%!
   3.81%  5.30%  2.92%  4.31%  3.53%  4.99%  4.15%  4.73%  3.50!
 %  5.32%
  3.58%  5.23%  4.10%  5.60%  3.21%  5.60%  3.61%  5.31%  3.69%  4.44%  3.73%  5.65%

This is the version of mailx being used:
Code:
$ mailx -V
12.4 7/29/08

Redhat Version
Code:
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)

This is the syntax used in the mailx command:
Code:
ssh <user>@<server> "cat <filename> | mailx -v -s '<subject>' -r 'no-reply@xxx.com' $emailList"

I have noticed that sending the email to a single person works perfectly fine, the line doesn't get wrapped. However, if the email list is extended to a mailing list, I get the output shown above. Any idea what could be the reason? Email is sent as plain text.
# 2  
Old 03-06-2017
try:
Code:
ssh <user>@<server> "mailx -v -s '<subject>' -r 'no-reply@xxx.com' $emailList < filename"

# 3  
Old 03-07-2017
Quote:
Originally Posted by vgersh99
try:
Code:
ssh <user>@<server> "mailx -v -s '<subject>' -r 'no-reply@xxx.com' $emailList < filename"

Same outcome.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting an unexpected newline in my while loop line-by-line feed

Hi, I'm trying to get a line returned as is from the below input.csv file in Bash in Linux, and somehow I get an unexpected newline in the middle of my input. Here's a sample line in input.csv $> more input.csv TEST_SYSTEM,DUMMY@GMAIL.COM|JULIA H|BROWN And here's a very basic while loop... (7 Replies)
Discussion started by: ChicagoBlues
7 Replies

2. Shell Programming and Scripting

Mail/mailx ignores newline formatting Problem.

I have a file hello.txt which i wish to send as a email body (not attachment). cat -ev hello.txt 1$ 2$ 3$ I use the following command to send the hello.txt as the email body. mailx -s "Alert" myteam@mycomp.com<hello.txt However, the email received has this in the email body 123... (2 Replies)
Discussion started by: mohtashims
2 Replies

3. Shell Programming and Scripting

Appending newline character End of File

Hi Gurus, Need help. I'm a beginner in Unix. I have a requirement, need to add or append newline (\n) character in file. Sample Data: 1|Main|Test|~# 2|Main|Hello|~# 3|Main|Unix|~# 4|Main|File|~#Output: 1|Main|Test|~# 2|Main|Hello|~# 3|Main|Unix|~# 4|Main|File|~#\n -- append only... (13 Replies)
Discussion started by: Gouri Solleti
13 Replies

4. Shell Programming and Scripting

cutting long text by special char around 100 byte and newline

Regard, How can i cut the text by special char(|) around 100 byte and write the other of the text at newline using Perl. ... (3 Replies)
Discussion started by: Shawn, Lee
3 Replies

5. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

6. Shell Programming and Scripting

solved -gawk, search for pattern - mark the previous line as a variable?

Im trying to parse ifconfig with awk and setup a bunch of variables in one shot. But Im having trouble figuring out how to work with data in previous lines. ifconfig output: eth0 Link encap:Ethernet HWaddr 00:50:DA:10:7F:1B inet addr:10.10.10.10 Bcast:10.10.10.127 ... (0 Replies)
Discussion started by: trey85stang
0 Replies

7. Shell Programming and Scripting

awk;sed appending line to previous line....

I know this has been asked before but I just can't parse the syntax as explained. I have a set of files that has user information spread out over two lines that I wish to merge into one: User1NameLast User1NameFirst User1Address E-Mail:User1email User2NameLast User2NameFirst User2Address... (11 Replies)
Discussion started by: walkerwheeler
11 Replies

8. Shell Programming and Scripting

Breaking long lines into (characters, newline, space) groups

Hello, I am currently trying to edit an ldif file. The ldif specification states that a newline followed by a space indicates the subsequent line is a continuation of the line. So, in order to search and replace properly and edit the file, I open the file in textwrangler, search for "\r " and... (14 Replies)
Discussion started by: rowie718
14 Replies

9. Shell Programming and Scripting

To remove the newline character while appending into a file

Hi All, We append the output of a file's size in a file. But a newline character is appended after the variable. Pls help how to clear this. filesize=`ls -l test.txt | awk `{print $5}'` echo File size of test.txt is $filesize bytes >> logfile.txt The output we got is, File size of... (4 Replies)
Discussion started by: amio
4 Replies

10. Shell Programming and Scripting

Appending the line number and a seperator to each line of a file ?

Hi, I am a newb as far as shell scripting and SED goes so bear with me on this one. I want to basically append to each line in a file a delimiter character and the line's line number e.g Change the file from :- aaaaaa bbbbbb cccccc to:- aaaaaa;1 bbbbbb;2 cccccc;3 I have worked... (4 Replies)
Discussion started by: pjcwhite
4 Replies
Login or Register to Ask a Question