2001-05-02 17:46:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Remove all those annoying ^M characters that Winblows editor's like to add
|
|
|
|
# from all files in the current directory and all subdirectories.
|
|
|
|
#
|
|
|
|
# Written by: Jonathan Haase.
|
2001-07-31 20:38:20 +00:00
|
|
|
#
|
|
|
|
# UPDATE: 7/31/2001: fix so that it doesn't touch things in the images directory
|
|
|
|
#
|
2004-03-21 15:02:57 +00:00
|
|
|
# UPDATE: 12/15/2003: Fix so that it doesn't touch any "non-text" files
|
|
|
|
#
|
2001-05-02 17:46:45 +00:00
|
|
|
|
|
|
|
find . > FILELIST.$$
|
|
|
|
grep -sv FILELIST FILELIST.$$ > FILELIST2.$$
|
|
|
|
grep -sv $(basename $0) FILELIST2.$$ > FILELIST.$$
|
2001-07-31 20:38:20 +00:00
|
|
|
grep -sv "^\.$" FILELIST.$$ > FILELIST2.$$
|
2004-03-21 15:02:57 +00:00
|
|
|
file -f FILELIST2.$$ |grep text | sed -e 's/^\([^\:]*\)\:.*$/\1/' > FILELIST
|
|
|
|
file -f FILELIST2.$$ |grep -sv text | sed -e 's/^\([^\:]*\)\:.*$/Not Modifying file: \1/'
|
2001-05-02 17:46:45 +00:00
|
|
|
rm FILELIST2.$$
|
|
|
|
rm FILELIST.$$
|
|
|
|
|
|
|
|
for i in $(cat FILELIST); do
|
|
|
|
if [ -f $i ]; then
|
2004-03-21 15:02:57 +00:00
|
|
|
sed -e s/
|
2001-05-02 17:46:45 +00:00
|
|
|
//g $i > $i.tmp
|
|
|
|
mv $i.tmp $i
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm FILELIST
|