remove newline and tab characters from filename
by oliveoyl from LinuxQuestions.org on (#5E13N)
Hello,
I've got some files that have \n and \t characters in the filenames that I'd like to remove.
This works great for the first newline:
rename $'\n' '' FILE*
I can run this again to remove the next new line but is it possible to capture multiple newlines with one command?
How to remove tabs? How to remove both at once?
# ls -lb
T1\tThisFileNameHas\tTabs
N1\nThisFileNameHas\nNewlines
TN1\tThis\nFileName\nHas\tTabsandNewlines


I've got some files that have \n and \t characters in the filenames that I'd like to remove.
This works great for the first newline:
rename $'\n' '' FILE*
I can run this again to remove the next new line but is it possible to capture multiple newlines with one command?
How to remove tabs? How to remove both at once?
# ls -lb
T1\tThisFileNameHas\tTabs
N1\nThisFileNameHas\nNewlines
TN1\tThis\nFileName\nHas\tTabsandNewlines