MANIFEST.MF dos2unix issues

I have a lot of jar files which I am transferring to unix. The issue is that the "MANIFEST.MF" is getting transferred with "^M" characters for each end of line in the file. Usually there is a tool which converts the Dos file format to unix and no "^M" character is added. But in this case there is no such tool provided. It is impossible to unjar each package and use this script:


Which converts the dos format file to unix file format.

Is there any other way of doing this. Thank you in advance. Urgent response will be much appreciated:)

Thank you
Who is Participating?
yuzhConnect With a Mentor Commented:
You can use "sed" or "tr" to do the job, eg:

sed 's/^M//g' file > newfile
mv newfile file


tr -d '\015'  <file >newfile
mv newfile file
atwork2003Author Commented:
Sorry if my question is confusing but I think u r converting one file at a time, right. If so I am already doing it. How do I convert more than one file at a  time.
Thank you
You can put all the file names in a text file and make it looks like:


named the file as filelist

then do:

for FILE in `cat filelist` ; do
    tr -d '\015'  <$FILE >${FILE}.tmp
    mv ${FILE}.tmp $FILE

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi atwork2003,
        Why a C grade? please have a look at the following page to learn
how to grade at EE, thank you!
atwork2003Author Commented:
yuzh, sorry about this. I gave C grade because my question was to get all the files converted (files with M^) with some sort of command without having to convert file one by one. dos2unix was fine but it can be used on every file individually. I think your answer was doing the same thing. Correct me if I am wrong. It was not answer to my question. So i thought, may be you can not convert file altogether.

I appologize for this, let me see how I can get it back to A.

I just saw your last comment, I am not at work but I think this is a good idea. thank you and again sorry for the grading.
atwork2003Author Commented:
I am opening a question about how to change the Grade, pls bear with me. thank you
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.