How to avoid CR after compression


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to avoid CR after compression
# 1  
Old 06-18-2009
How to avoid CR after compression

Hi all,
I am having few files which needs to be concted into a single file and then it is compressed and FTPed from the UNIX server to the Windows server.

For the above purpose i am using gzip command to compress the files after concetenation.
And i am FTP ing the compressed file in the binary mode.
Thus transfered file contains a carriage feed(CR) inserted for every new line. I want to avoid this CR and it should be a new line itself.

I doubt that the presence of CR is due to the compression (When i tried to FTP the concated file without compressing there is no CR inserted for a new line.The output is as desired)

Could any one suggest me a way to avoid the CR which is inserted as a result of compression?
Or is there any command other than gzip and compress inorder to compress the files without a CR?

Any help is greatly appreciated.
# 2  
Old 06-18-2009
Windows stores text files with a CR/LF pair as line terminator while Unix based systems use a LF.
Convert the files before you compress them with the tool unix2dos. If it's not available on your system you can use awk:

Code:
awk '{printf "%s\r\n", $0}' unixfile > tempfile
mv tempfile > unixfile

Regards
# 3  
Old 06-18-2009
Thanks for your efforts Franklin.
Now the output file contains a new line inserted as well as a CR at the end oof the statement.
Kindly help me Smilie
# 4  
Old 06-18-2009
Statement? What statement?

You should be able to read a converted text file in notepad or another windows text editor if the lines are terminated with a CR/LF pair.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Best Compression technique ?

Hi all, I am working on a sample backup code, where i read the files per 7200 bytes and send it to server. Before sending to server, i compress each 7200 bytes using zlib compression algorithm using dictionary max length of 1.5 MB . I find zlib is slow. Can anyone recommend me a... (3 Replies)
Discussion started by: selvarajvss
3 Replies

2. Shell Programming and Scripting

file compression

I'am looking for script (or tool) that would compress all files with given extension in all subdirectory. Important part is that every one file have to end in separate archive whit it's own name. Eaven if I could point multiple file in one directory and compress them it would be ok. I' am... (1 Reply)
Discussion started by: Demerzel
1 Replies

3. Shell Programming and Scripting

Folder compression

Hi Guys, totally new to scripting. I have a huge list of foleders. I want to tar the contents of each folder inside the same folder and the name of the tar file is the same name as the folder. how would I go about this in scirpt? cheers Viper (3 Replies)
Discussion started by: brownviper1966
3 Replies

4. AIX

Tape compression

Hello everyone I want to use compression in my tape when I backup some file. For example I have several files that use 50gb. If I backup this I need to use two cartridge because without compression I can backup 36gb. My question is with flag I need to use to compress and I can use 72gb in... (2 Replies)
Discussion started by: lo-lp-kl
2 Replies

5. UNIX for Dummies Questions & Answers

Un-compression types...

Hi Folks, As I am familiar wih both types compresion forms: gun-zip and .rpm. My questions is how do I uncompress gunz.zip type? As the .rpm I can double click and it will extract...Can someone shed some light on this and thank you... M (2 Replies)
Discussion started by: Mombo_Z
2 Replies

6. UNIX for Dummies Questions & Answers

.z file compression

Hello, I have a .z file which i understand to be UNIX. I'm on PC (no UNIX boxes) and have tried many different unzipping programs to extract this .z file, but only PicoZip has allowed me to view what is inside (telling me, i think, that it's not corrupt), but i have not been able to extract... (3 Replies)
Discussion started by: Gonecat
3 Replies

7. UNIX for Advanced & Expert Users

Move with compression

How can I move a file and compress it at the same time? (8 Replies)
Discussion started by: truma1
8 Replies

8. UNIX for Dummies Questions & Answers

.bz2 compression

I have heard that bz2 compression a relatively new compression encoding algorithm, far superior to tar and gz. I also remember that I downloaded a FreeBSD LiveCD a while back that was only a couple hundred megs instead of the usual 650ish using bz2 - big difference, I'd say. But to the point, what... (4 Replies)
Discussion started by: Phobos
4 Replies

9. UNIX for Dummies Questions & Answers

compression utilities

I've noticed bzip2 gives a little bit better compression than gzip. So...I'm curious...what's gives the best compression out of all the compression utilities? Thanks! (6 Replies)
Discussion started by: jalburger
6 Replies

10. UNIX for Dummies Questions & Answers

file compression

Is it possible to unzip / compress a file that was zipped using WinZip? thanks, kristy (2 Replies)
Discussion started by: kristy
2 Replies
Login or Register to Ask a Question