I have several files that are named like this: file - name.txt
How do I remove the " - " using a bash script in UNIX from all the files?
Use parameter expansion to remove the part of the string you want to be rid of. Make sure to use double-quotes to prevent mv
from misinterpreting input.
for i in ./*' - '*; do
mv "$i" "${i// - }"
done
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments