![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to remove directory with subdirectories and files? | ppa108 | UNIX for Dummies Questions & Answers | 9 | 1 Week Ago 11:02 PM |
| read list of filenames from text file and remove these files in multiple directories | fxvisions | Shell Programming and Scripting | 5 | 08-07-2008 12:59 PM |
| Display only subdirectories from given directories | HAA | Shell Programming and Scripting | 8 | 04-25-2007 02:36 AM |
| Need to remove files older than 30 days except directories | malaymaru | Shell Programming and Scripting | 6 | 11-13-2006 08:50 PM |
| Check all files in directories for string and remove.. possible? | LordJezo | Shell Programming and Scripting | 7 | 11-29-2005 10:00 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to Remove Ctrl M characters in files from directories and its subdirectories
Hi,
How to recursively remove Ctrl M characters in files from a directory and its sub directory ? I know unix2dos command is there but to remove in bunch of files ... ? Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
You need to write a script.
|
|
#3
|
|||
|
|||
|
Try modifying with the following script............
for files in *.html; do mv $files $files.old dos2unix $files.old $files rm -rf $files.old done |
|
#4
|
|||
|
|||
|
Code:
find /path/to/files -print | \
while read file
do
dos2ux "$file" > ./tmpfile
mv ./tmpfile "$file"
done
|
|
#5
|
|||
|
|||
|
Reply to the script by corleone
Hi corleone,
Iam getting error /could not open /dev/kbd to get keyboard typed ...... Do I need to save the script in .sh format ? How do I run the script ? Kindly reply since Iam naive. Iam using unix on solaris. Thanks |
|
#6
|
|||
|
|||
|
This error comes from dos2unix and doesn't stop the utility from working. You could simply redirect stderr
dos2unix filename > newfilename 2> /dev/null |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|