Reputation: 136
I want to execute following command on all files of a directory and also on all files in sub directories of that directory:
cat filename | col -b > filename
this command will remove control M
or ^M
character from the file and works fine with single file. Please help ...
I tried below command but doesn't work. It works with single directory but not with sub directories.
for i in *
do
cat i | col -b > i
done
Upvotes: 3
Views: 1356
Reputation: 1476
find . -type f -name '*.gif or .jpeg' -o -exec sed -i 's/^M//' {} \;
this is what your looking for ^M it works in all file to remove the images. just check it in you are code
Upvotes: 1
Reputation: 7823
find . -type f -exec sed -i 's/^M//' {} \;
Note, do the ^M by hitting ctrl-V then ctrl-m, not just ^M
If you want to only hit a subset of files, then specify an appropriate regexp and pass that to find as (most likely) -iname
- see man find
for the options
Upvotes: 0