Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting multiple files with dos2unix utility on solaris 9

Status
Not open for further replies.

jcpelejo

Programmer
Jul 29, 2001
70
US
Is there a way of converting multiple files at the same time so that you do not have to type the command "dos2unix <oldfilename> <newfilename>" one file at a time?

Life is too short to waste...
Julius Pelejo
jcpelejo@hotmail.com
 
Perhaps put your filename pairs in a file and feed them to dos2unix? I guess that wouldn't save you too mich time though!

I want to be good, is that not enough?
 
A shell script should do it.

Here is one written in "bash", all your files ends with .txt and all new files i created in a directory named "converted".

Code:
#!/bin/bash
mkdir converted
for i in *.txt; do
dos2unix $i converted/$i
done

Should be easy to convertet this script to other "script languages".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top