Processor
Processor

Reputation: 324

delete or symlink with ^M in filename

a bash script that used a Windows output file, generated me files and symlinks with ^M in the filename or link name.

when I do a ls /var/bla followed by a [tab] I see names like : file^M.pdf

when I do a ls /var/bla followed by a [enter] I see names like : file?.pdf

I would like to remove all of these files but a :

find /var/bla -name '*^M.*'

or

find /var/bla -name '*?.*'

do not give the attended results. the first case does not match anything and the second everything but not what I need.

Does anybody has an idea to remove these files?

Thanks by advance.

Upvotes: 0

Views: 24

Answers (1)

Barmar
Barmar

Reputation: 781868

Use $'...' to create a string using C-style escape sequences.

find /va/bla -name $'*\r*'

Upvotes: 1

Related Questions