#!/bin/bash for f in *; do newname=`echo $f | sed -e "s/\s/_/g"` mv -v "$f" $newname done