[Solved] line breaks missing when emailed from unix to win


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [Solved] line breaks missing when emailed from unix to win
# 1  
Old 07-02-2012
[Solved] line breaks missing when emailed from unix to win

hi

i am sending an email from unix to windows platform and using uuencode to attach the plain text files (.txt). But when i read the attached file in notepad the linebreaks are gone.

Code:
 
uuencode samplefile.txt samplefile.txt | mail -s "test email" <mailid.com>

if i copy paste the same text in textpad im able to see the line breaks. is there a way i can see the same way in the notepad
# 2  
Old 07-02-2012
Windows uses \r\n as \ line break whereas Unix uses \n. You can pre-filter file like so:
Code:
sed 's/$/\r/' <samplefile.txt >sampleflie.win.txt

This User Gave Thanks to Skrynesaver For This Post:
# 3  
Old 07-02-2012
i tried the command

Code:
sed 's/$/\r/' <samplefile.txt >sampleflie.win.txt

there is no change in the way i see the text in the mail attachment, i checked in the text file (changed by the command) and found there is an extra 'r' at the end of all lines.

do we need to change any thing in the above command
# 4  
Old 07-02-2012
It would help to know what Operating System and version you have.
Most mainstream unix have the ux2dos or unix2dos conversion program. Run the conversion before the uuencode.
Not all versions of sed recognise \r.

Last edited by methyl; 07-03-2012 at 08:45 AM.. Reason: minor typo
# 5  
Old 07-03-2012
the operating system is AIX version 6

ux2dos and unix2dos are not in the system.... is there any other way to convert the files into dos format
# 6  
Old 07-03-2012
If your sed doesn't recognise carriage return \r use a tool that does
Code:
perl -pi.bak -e 's/$/\r/' path/to/file

This User Gave Thanks to Skrynesaver For This Post:
# 7  
Old 07-04-2012
Thanks ... that is working
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[BASH] read 'line' issue with leading tabs and virtual line breaks

Heyas I'm trying to read/display a file its content and put borders around it (tui-cat / tui-cat -t(ypwriter). The typewriter-part is a 'bonus' but still has its own flaws, but thats for later. So in some way, i'm trying to rewrite cat using bash and other commands. But sadly it fails on... (2 Replies)
Discussion started by: sea
2 Replies

2. UNIX for Dummies Questions & Answers

Page breaks and line breaks

Hi All, Need an urgent solution to an issue . We have created a ksh file or shell script which generates 1 DAT file. the DAT file contains extract of a select statement . Now the issue is , when we are executing the ksh file , the output is coimng with page breaks and line breaks . We have... (4 Replies)
Discussion started by: Ayaskant
4 Replies

3. UNIX for Dummies Questions & Answers

Convert UNIX text file in Windows to recognize line breaks

Hi all, I have some text files that I prepared in vi some time ago, and now I want to open and edit them with Windows Notepad. I don't have a Unix terminal at the moment so I need to do the conversion in Windows. Is there a way to do this? Or just reinsert thousands of line breaks again :eek: ? (2 Replies)
Discussion started by: frys_hp
2 Replies

4. Windows & DOS: Issues & Discussions

Convert UNIX text file in Windows to recognize line breaks

Hmmm I think I found the correct subforum to ask my question... I have some text files that I prepared in vi some time ago, and now I want to open and edit them with Windows Notepad. I don't have a Unix terminal at the moment so I need to do the conversion in Windows. Is there a way to do this?... (1 Reply)
Discussion started by: frys_hp
1 Replies

5. Programming

Clean and keep line breaks

Hello, I want to keep line spaces in comments but clean more then 2 after each. Example: $sentence="This is my first sentence This will be in a new row This will be too in a new row but not separated with 3line breaks just with one "; And i want to... (1 Reply)
Discussion started by: AimyThomas
1 Replies

6. Shell Programming and Scripting

[Solved] missing date in unix

i have a file with below contents Mg_Message_count,1-Aug-12,46 Mg_Message_count,2-Aug-12,48 Mg_Message_count,3-Aug-12,48 Mg_Message_count,4-Aug-12,48 Mg_Message_count,5-Aug-12,48 Mg_Message_count,6-Aug-12,48 Mg_Message_count,7-Aug-12,42 Mg_Message_count,20-Aug-12,24... (10 Replies)
Discussion started by: rabindratech
10 Replies

7. Shell Programming and Scripting

Unix find missing new line

Hi All, I wanted to check out a missing new line character from last line on Unix. If file is having newline character at the end of last line then it should show as "\n" else will display the last character whatever it is. OR If file is having newline character at end of last line... (8 Replies)
Discussion started by: gr8_usk
8 Replies

8. Shell Programming and Scripting

[Solved] Read a line from one string till to another.... Unix scripting..

So i have a file which contains paths to JPG images separated by a space. I have to separate them each path to another file. So, I have to search all strings that start from /home/ and ends with .jpg or .png Then write each one to another file... Can you please help me on doing this???:cool: (11 Replies)
Discussion started by: hakermania
11 Replies

9. Shell Programming and Scripting

Help with wc and line breaks

Hi everyone, I have gone through the forum trying to find an answer to this question but was unsuccessful. I am hoping that someone can help me with this please. I am trying to get my script to recognise line breaks from a file and to give me a result for wc of each line. So basically, if you... (7 Replies)
Discussion started by: stargazerr
7 Replies

10. Shell Programming and Scripting

any better way to remove line breaks

Hi, I got some log files which print the whole xml message in separate lines: e.g. 2008-10-01 14:21:44,561 INFO do something 2008-10-01 14:21:44,561 INFO print xml : <?xml version="1.0" encoding="UTF-8"?> <a> <b>my data</b> </a> 2008-10-01 14:21:44,563 INFO do something again I want... (3 Replies)
Discussion started by: csmklee
3 Replies
Login or Register to Ask a Question