perl -p -i -e 's/ where/' where/g' *.sql #### # Note the second single-quote below perl -pi.orig -e 's/ where/'' where/g' *.sql