Display the content in different lines in email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Display the content in different lines in email
# 1  
Old 06-08-2010
Display the content in different lines in email

Hi,
I am checking if a file exists or not and based on the result I am sending an email. The email part works fine but the content of the email comes in a single line and I am not able to display it in diferent lines.

Code:
 
 
if [ ! -f /abc/batch/readyFile/errorOccured.ready ]; then
   echo "Hi, \\n An exception exists in the process. \\n Regards \\n Test"  | mail -s "Error in Process" shanth.chandra@abc.com
else
   echo "File exists"
fi

-----------------------------------------------------------------------
The email content is displayed as:

Hi, \n An exception exists in the process. \n Regards, \n Test

but rather I need the email content as:

Hi,

An exception exists in the process.

Regards,
Test
-----------------------------------------------------------------------

regards
Prashanth
# 2  
Old 06-08-2010
Use printf:
Code:
printf "Hi, \nAn exception exists in the process. \nRegards \nTest"

This User Gave Thanks to Franklin52 For This Post:
# 3  
Old 06-08-2010
try with
Code:
echo -e

may be helpful.
# 4  
Old 06-08-2010
Thanks printf works.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need Suggestion, on how to constantly moniter a file and display content with in that time

Dear Gurus, I'm in a strange situation, hence need some kind of advice or possible syntax to carry on. let's say current time/date is 2013-12-18, 15:58:15 I got a file something like this, which keep getting updated with respect to time. 2013-12-18,... (4 Replies)
Discussion started by: manas_ranjan
4 Replies

2. Shell Programming and Scripting

Grep to display file name along with content in Solaris

Am using the following grep to match a particular patter in grep. grep xyz abc.txt now while i run this command, if the pattern matched, am getting the line containing xyz Output: xyz is doing some work Now if i want the file name also along with my output, what should i do Expected... (2 Replies)
Discussion started by: rituparna_gupta
2 Replies

3. Shell Programming and Scripting

Display specific lines content from the file

Hell, I want to grep certain word from file and display above 2 lines and after two lines. Here is the content of sample file. Mar 14, 2013 12:56:59 AM Agent.Agent SendTo INFO: Connection to server:7041 - Credential Transmit Successesful Mar 14, 2013 8:54:21 AM cgent SendTo WARNING:... (7 Replies)
Discussion started by: balareddy
7 Replies

4. UNIX for Dummies Questions & Answers

Email display not correct on Solaris 10

Hi Everyone, Can someone possibly point me in the direction? When I execute command echo "hello" | sendmail -v testacct@wyx.com I recived an email as expected except the From: NAME is incorrect. The server name is correct. It should read "From: TESTBOX1 " actual email: From: app... (3 Replies)
Discussion started by: smckech1972
3 Replies

5. Shell Programming and Scripting

Format of content displayed in the attachment of email

Hi, I'm facing a problem in mailing attachments using uuencode in mailx. I got to attach a couple of flatfiles. I'm able to attach and mail the files successfully. But there is a problem in the format of the flatfiles when they are received as an attachemnt. For Example : Consider... (0 Replies)
Discussion started by: Sindhuap
0 Replies

6. UNIX for Dummies Questions & Answers

Display the content of the unix file

cat is the normal unix command to display the content of a file. Is there any program to display the content of the file. If there is, then can you send me the code. (5 Replies)
Discussion started by: vedanjalig
5 Replies

7. UNIX for Advanced & Expert Users

To change the colour of the content in email sent through unix

Hi I want to change the color of the email content sent through unix. I tried a lot and left in vain. I heard that it could be done by sending the email as HTML. But I don't how to do it. Can you all share your ideas? ~sakthifire (1 Reply)
Discussion started by: sakthifire
1 Replies

8. Shell Programming and Scripting

display content between all similar tags pattern

hi, I m stuck at a point for more than 3days. My doubt is pretty simple.. I have a web page content in $content. ( got this by using LWP).. Now I want to display the content matching a pattern. I tried if($content =~ m{<div class="abc">(.*?)</div>}s){ print $1;} that will... (4 Replies)
Discussion started by: therockravi
4 Replies

9. UNIX for Dummies Questions & Answers

display files name and it's content

hello, i have a question and i'll be appreciated if you can help me with this. i have i folder let's say "users" in this folder there are files (file1, file2, file2, etc) and in each file there is a number (lets say 4 in file1) i want to display some thing like bellow file1 4... (6 Replies)
Discussion started by: dndoon
6 Replies

10. Shell Programming and Scripting

how to send an email with some body content and attachment

hi plz help me in sending a mail with some data in body and an attachment as some txt file. currently i am able to send mail with some body content, i need an example how to send the same along with attachment. thanks in advance -bali (2 Replies)
Discussion started by: balireddy_77
2 Replies
Login or Register to Ask a Question