uuencode sends output all in 1 line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting uuencode sends output all in 1 line
# 1  
Old 05-31-2011
uuencode sends output all in 1 line

Hi, I need to send a email as a txt file and i used the commands,


Code:
Code:
(echo `echo $EMAIL_MSG` ; uuencode "file.txt" "file.txt" ) | mailx -s "$EMAIL_SUBJECT" "$EMAIL_ID"

I received email with a attachment with all data but i get all of them in one row.

For example:
If file.txt contains value as below
1
2
3
4
5

I receive them as 1 2 3 4 5. All in one row which i don't want....

I need them as it is.. like
1
2
3
4
5

Can anyone please help me ?

Thanks in advance!
# 2  
Old 06-01-2011
Code:
echo `echo $EMAIL_MSG`

This is a useless use of backticks. echo `echo something` seems especially futile since all you want to do is echo it!

The newlines are being stripped out because you didn't put EMAIL_MSG in quotes.

Try
Code:
(echo "$EMAIL_MSG" ; uuencode "file.txt" "file.txt" ) |
        mailx -s "$EMAIL_SUBJECT" "$EMAIL_ID"

# 3  
Old 06-01-2011
Thanks for the reply!

Quote:
(echo "$EMAIL_MSG" ; uuencode "file.txt" "file.txt" ) |
mailx -s "$EMAIL_SUBJECT" "$EMAIL_ID"
I tried using the above command and it gives the same result.

Still I'm getting them in one row.

any other suggestions please ?


Thank you!
# 4  
Old 06-01-2011
Where is your EMAIL_MSG variable coming from?
# 5  
Old 06-01-2011
EMAIL_MSG="Attachment contains the report"

I had harcoded the EMAIL_MSG as above.
# 6  
Old 06-01-2011
I'm not having much getting uuencode/uudecode to work at ALL. They're really strange things.

---------- Post updated at 10:10 PM ---------- Previous update was at 10:07 PM ----------

What system are you checking the emails in? It may just be a windows carriage-return vs unix newline thing. Add carriage returns with sed 's/$/\r/' < infile.txt > tosend.txt
# 7  
Old 06-01-2011
Any other option without using uuencode/uudecode with all these parameters ?

Can you please suggest ?

---------- Post updated 06-01-11 at 01:01 AM ---------- Previous update was 05-31-11 at 11:18 PM ----------

I don't understand
Quote:
sed 's/$/\r/' < infile.txt > tosend.txt
.

Could you please explain me how to use with uuencode above ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

2. Shell Programming and Scripting

How to read the output of a command line by line and pass it as a variable?

Hi, I have some 2000 names in a table like below. Java Oracle/SQL ANSI SQL SQL,DWH,DB DB&Java And by using for loop in my code i am able to get a single word but if there is any special character or space then it is considering as a next line. I have to execute the below queries in... (10 Replies)
Discussion started by: Samah
10 Replies

3. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

4. Shell Programming and Scripting

Sh script sends SIGINT to a process

Hello, What I want to accomplish is this: I have made a very simple script that runs 2 commands, polipo proxy and tor. The script runs successfully and the output of tor is visible to the screen. I am using the trap command in order to catch the ctrl+c button combo in order to stop polipo... (5 Replies)
Discussion started by: redsolja
5 Replies

5. Shell Programming and Scripting

attachment and single line using uuencode

I tried using the fllowing command to attach and email a file but the issue is the attach file drops the carriage return or line feed and all the rows appears in single line. uuencode file.txt file.txt | mail user@gmail.com Any solution guys (3 Replies)
Discussion started by: RubinPat
3 Replies

6. Shell Programming and Scripting

Converting line output to column based output

Hi Guys, I am trying to convert a file which has a row based output to a column based output. My original file looks like this: 1 2 3 4 5 6 1 2 3 1 2 3 (8 Replies)
Discussion started by: npatwardhan
8 Replies

7. Red Hat

Sendmail sends messages like root

Hi, we are setup sendmail like a relaying. We are using user authetecing in the smart mail host. But when we use sendmail to send a message, the message is rejected, because user root, not is a user known in the domain. Where or what must i do, to can be able to send messages from the sendmail... (0 Replies)
Discussion started by: iroshit
0 Replies

8. Shell Programming and Scripting

single line input to multiple line output with sed

hey gents, I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies

9. Shell Programming and Scripting

how to make a line BLINKING in output and also how to increase font size in output

how to make a line BLINKING in output and also how to increase font size in output suppose in run a.sh script inside echo "hello world " i want that this should blink in the output and also the font size of hello world should be big .. could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies

10. AIX

sendmail only sends emails to its own domain

Hi, folks! I have a problem with an AIX 5.3 server running sendmail where it is able to send messages within its own domain just fine. This is being used for a web email service portion of a web site. However, when it attempts to send email to any other domain -- i.e., hotmail.com -- it... (3 Replies)
Discussion started by: jjwood64
3 Replies
Login or Register to Ask a Question