How to get 2 records in 2 separate lines in the mail


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to get 2 records in 2 separate lines in the mail
# 1  
Old 08-24-2009
How to get 2 records in 2 separate lines in the mail

export VarMailAddress=abc@gmail.com
export SUBJECT="Hi"
(
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
echo "<HTML><BODY>"
echo "<B> <U>NAME&nbsp;&nbsp;ID&nbsp;&nbsp;Address </B> <br /> "
echo "`cat FILE`"
echo "</BODY></HTML>"
) | /usr/sbin/sendmail $VarMailAddress

Here FILE contains:
abc 43 ghju
iop 56 hjmgkl

but in the mail, above two records are coming in a single line like:
abc 43 ghju iop 56 hjmgkl

My requirement is to get 2 records in separate lines.

can anybody help me in this ASAP

Thanks in advance.
# 2  
Old 08-24-2009
Remove the echo from around the cat.
# 3  
Old 08-24-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

*****************************************************


Try to remove the echo of that line and also remove the backticks around the cat.
# 4  
Old 08-24-2009
Hi

I tried that option.Even though i am getting the 2 records in single line while sending an email

can anybody help in this?

Thanks in advance
# 5  
Old 08-24-2009
Please edit your post as I asked for and add the code tags.

Just tested it on my Debian Linux box:
Code:
(echo eins; cat infile; echo zwei)| mail -s test zaxxon@somedomain.de

Output in my mailer:
Code:
eins
bababa nobody bababa
tftp          dgram   udp      wait    nobody  /usr/sbin/tcpd  in.tftpd  /tftpboott
lalala nobody lalala
zwei

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Ls to text file on separate lines

hi, I'm trying to print out the contents of a folder into a .txt file. The code I'm trying amongst variations is: ls -1 > filenames.txt but it prints them all on the same line ie. image102.bmpimage103.bmpimage104.bmpimage105.bmpimage106.bmp how can I change this? Please... (2 Replies)
Discussion started by: newbie100
2 Replies

2. Shell Programming and Scripting

Separate records of a file on 2 types of records

Hi I am new to shell programming in unix Please if I can provide help. I have a file structure of a header record and "N" detail records. The header record will be the total number of detail records I need to split the file in 2: One for the header Another for all detail records Could... (1 Reply)
Discussion started by: jamcogar
1 Replies

3. Programming

Separate input buffer into multiple lines

Hi All I have a very tricky problem, not able to solve it. Hence asking this question. I have a code portion like this - int parse_msg(in_buf,line1,line2,sccs_line) char in_buf; char line1; char line2; char sccs_line; { .... (void)fprintf(trace_fp,"parse_msg1 in_buf = %s \n",... (0 Replies)
Discussion started by: nsinha
0 Replies

4. Shell Programming and Scripting

how to write on separate lines?

Hello friends, I have a file "a.txt" its contents ----------------- pid 4075 (caiopr) shmat(1929379932, 0x0000000000000000, 0) = 0x00000000ff030000 (errno 0) pid 4075 (caiopr) shmdt(0x00000000ff030000) = 144 (errno 0) pid 4075 (caiopr) shmctl(1929379932, IPC_RMID) pid 4205 (cau9cli.exe)... (2 Replies)
Discussion started by: Sunusernewbie
2 Replies

5. Shell Programming and Scripting

separate records

i have a file contains continues records; i want to separate each section that has the same 1st field by putting ''###''. 1 salam_32 tr po 1 sed_po wqu 1 Pdot. food 32 2 eeeelll 2 wwwqww qwqw e 3 d 3 r 3 0 3 322 1 salam_32 tr po 1 sed_po wqu 1 Pdot. food 32 ### 2 eeeelll 2... (1 Reply)
Discussion started by: oreka18
1 Replies

6. Shell Programming and Scripting

loop through lines and save into separate files

I have two files: file-gene_families.txt that contains 30,000 rows of 30 columns. Column 1 is the ID column and contains the Col1 Col2 Col3 ... One gene-encoded CBPs ABC 111 ... One gene-encoded CBPs ABC 222 ... One gene-encoded CBPs ABC 212 ... Two gene encoded CBPs EFC... (7 Replies)
Discussion started by: yifangt
7 Replies

7. Shell Programming and Scripting

Combine the lines from separate text files

Hi All, I have three separate text files which has only one line and i want to combine these lines in one text file which will have three lines. cat file1.txt abc cat file2.txt 1265 6589 1367 cat file3.txt 0.98 0.36 0.5 So, I want to see these three lines in the... (9 Replies)
Discussion started by: senayasma
9 Replies

8. Shell Programming and Scripting

Separate lines from text file

I have a text file with lot of rows like.. Action & Adventure|2012: Supernova NR|2009-11-01 00:01:00|2010-05-01 23:59:00|Active|3 Action & Adventure|50 Dead Men Walking|2010-01-05 00:01:00|2010-06-30 23:59:00|Active|3 Action & Adventure|Afterwards|2009-11-26 00:01:00|2010-03-26... (3 Replies)
Discussion started by: ramse8pc
3 Replies

9. Shell Programming and Scripting

Direct the invalid lines to a separate files

Hi, I have a pipe delimited file with 1 million records. I need to validate each line by counting the number of delimiters, if any line fails to have the specified number of delimiters, taat line has to be sent to a reject file. Kindly suggest. if code provided, it is highly appreciated, and... (22 Replies)
Discussion started by: anandapani
22 Replies

10. Shell Programming and Scripting

Separate lines in a single '|' separated line

Hi I have a file with contents like china india france japan italy germany . . . . etc.... I want the output as china|india|france|japan|italy|germany|.|.|. (3 Replies)
Discussion started by: hidnana
3 Replies
Login or Register to Ask a Question