# For each file, change all characters not in [] below to '_' # and move to ~/doc. # I'm running this from the command line, not from a script. # Error message I get: # mv: target `/home/bytecolor/doc/file_name_with_underscores.pdf' is not a directory $ for f in *; do $ mv $f ~/doc/`echo $f | tr -cs '[A-Za-z0-9_.\n]' _` $ done