[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.

 
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

Windows uses \r\n as \ line break whereas Unix uses \n. You can pre-filter file like so:

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

i tried the command

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

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 .

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

If your sed doesn't recognise carriage return \r use a tool that does

perl -pi.bak -e 's/$/\r/' path/to/file

Thanks ... that is working