There'll be dozens of different ways to do this - one option is to use
parameter expansion in the shell to replace the unwanted characters with a safer one.
For example, this creates a badly named file, fixes the filename, then renames it:
Code:
orig_filename=$'TN1\tThis\nFileName\nHas\tTabsandNewlines'
echo test > "$orig_filename"
new_filename="${orig_filename//[$'\t'$'\n']/-}"
mv --no-clobber "$orig_filename" "$new_filename"
Both newline and tab characters are replaced with the value between / and }" in the penultimate line - in the above example, a single hyphen - but you could remove that to have the characters removed instead. The double slashes // makes it change all occurrences instead of just the first.
The
--no-clobber option to mv prevents any existing files being overwritten if there is a naming collision. (Allowing you to choose a different replacement string to avoid that collision).