This should work as well. It removes all control characters (ascii octal 000-037,177).
Code:
file="Overview_Troms?_2-thumb-144xauto-40672.jpg"
mv "$file" "${file//[[:cntrl:]]}"
You probably need to use some kind of globbing or other automatic file matching to get the filename into the variable; a simple
for loop or somesuch.
You can specify a replacement character as well. Just use "
${file//[[:cntrl:]]/-}" to change them to to hyphens, for example.
Edit: I just noticed what you said about having trouble searching for such files. You can use the
[:cntrl:] character class in a regex or glob as well.
Code:
for file in ./*[[:cntrl:]]* ; do
mv "$file" "${file//[[:cntrl:]]}"
done
You can also use ansi-c quoting to include specific non-printing characters in a string, in octal or hex.
Code:
ls *$'\177'*
ls *$'\x7f'*