Search code examples
bashreplacerenamefilenamesfile-rename

rename files with '$'\374'' on bash


I have multiple files from a defect usb-stick. Many of them have the "._" from Mac OS in the beginning, which should be kept. Some files have substitues for the german ä, ö or ü which are shown on the bash (ls -al) like:

'Pr'$'\374''fung_File.pdf'

How can I remove the '$'\374''? I have tried:

rename -n 's/\\'/_/g' *

which does not work.


Solution

  • ls's output is a bit misleading, your files don't really have quotes or dollar signs in their names. Try:

    rename -n 's/\374/_/' *
    

    remove -n if its output looks good.