How can I remove whitespace characters within file names?
File names in unix can contain all kinds of whitespace characters, not just spaces. The following examples only work with spaces, adjust accordingly. a. Use the substitution capabilities of awk, sed, et al. f=`printf ‘%s\n’ “$filename” | sed ‘s/ /_/g’` f=`printf ‘%s\n’ “$filename” | awk ‘{gsub(” “,”_”);print $0}’` f=`printf ‘%s\n’ “$filename” | tr ‘ ‘ _` Add characters to the tr command line as needed (see the man page for tr to find out the available escape sequences). Additionally (although not exactly a one-liner) f=`tr ‘ ‘ _ <