UNIX/Linux - awk - displaying unxpected ! character when viewed in mail; but not in actual file
Greetings Experts,
I am on AIX using ksh; I am processing the input files and generating a awk_output.txt file using AWK. By reading that awk_output.txt file, I am building a output.html file which is cat and then fed to /usr/sbin/sendmail .When the shell script is triggered through command line, the script processes the multiple files at the given location and then builds the awk_output.txt file using awk Then by reading the contents of the awk_output.txt through while loop, I am building the output.html file with respective html tags. Then /usr/sbin/sendmail is invoked to read the contents of output.html file using echo `cat output.html` and send mail. I know without sample script/file it is really difficult to point out the exact issue. But I can't share the script/file as it is on remote machine.
Issue: When the mail is received, I see that there is extra ! {!followed by a space} at random locations at 5th line and 11th line. ( It occurs on the random line numbers after every re-run which deletes the same file and re-creates it )
When I open the same output.html file directly in the Unix server ( which opens in Internet Explorer), I am seeing the data as expected i.e., without ! I am really frustrated with this. Please note that when the number of characters in the output.html file is low (around 200 characters; 12 rows with 3 columns; column1 length=10; column2_len=3; column3_len=3) this issue doesn't exist. But when the output.html file contains more number of characters (12 rows with 5 columns; column1 length = 20; column2_len=30; column3_len=3; column4_len=3; column5_len=5) the issue creeps up. Assumption of any embedded non-printable character in the script is overruled as we pass 3 different arguments to the script 3 times and the ! occurs at different locations.
Eg contents when opened the output.html file in Unix server which doesnot have issue i.e., without ! :
Eg contents seen through outlook mail which has issue i.e., ! occurs at random locations
As you can see, when the actual output.html file is opened in Unix server, it opens in Internet Explorer and I don't see any ! symbols. But the same file is cat and sent through mail and then I see those ! symbols at random positions at about 3 times. I have verified the octaldump of the lines that had ! in between them in the output.html file and I don't see any issues with it. Can you please help to understand and resolve this. Thank you for your time.
How to attach a file in Linux mail command
Hi Guys,
Is there any way to attach a file in Linux mail command without using "uuencode"?
i.e.
Code:
file=/a/b/c/d/file.txtmail -s "Giga aks" abc@123.com <<HDoc`uuencode $file $file 2>/dev/null`HDoc
Here, I don;t want to use 'uuencode'... (1 Reply)
Hi all. I have a couple of scripts looking at my syslog.log, mail.log, and messages logs.
My scripts work well with syslog.log and messages logs. I use grep function and then make exceptions to things that I know happen often and that way can investigate better without being buried with... (2 Replies)
Hi All,
I need to write a "portable" shell script that can send mail from Unix or Linux servers.
In my server Linux I find mutt and I need to attach a file
In my server Unix mutt is not present. Only mail/mailx. In this case for attaching a file I need to pipe the uuecode command.
My... (1 Reply)
Hello! I created a file that displays text underlined. However when I pass the file into the mail utility it doesnt display the underline.
Here is the code:
echo "\n\033
cat test_underline.txt
mail -s "testing of underline" <email_address> < test_underline.txt
Any ideas?... (8 Replies)
Hi !
I-m copile from source a C++ program from tutorials from internet. I don't understendig any programing languages.. but compiled aplication running ok.
I-ts possible to add in my used program, lines to send one file from config directory in e-mail, to my e-mail adress ?
I want to run... (2 Replies)
i've vi'ed some scripts in the past and when i did, my screen froze. i had to go to another terminal and kill the vi process before i was able to get back my screen.
how can i replicate this behavior on purpose? i want be able to do this also if the file or script was doubled clicked, say... (17 Replies)
I need top load memory and cpu uses in mail. I am getting mail, but output is coming in sentence format.
can help me, how can I get in actual format. below is the command.
echo `ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head`|mailx -r `hostname -s`@abc.com abc@abc.com (5 Replies)