Rename a pile of files for F in tt_* do mv $F pe` expr $F : 'tt\(.*\)' ` done or for F in tt_* do mv $F pe_`echo $F | sed 's;tt_\(.*\);\1;'` done or for F in tt_* do mv $F ` echo $F | sed 's-tt-pe-' ` done How about just within the KornShell ? ? ? If the user's shell is /bin/ksh, then, from the command line, just: for F in tt_* ; do mv $F pe_${F#*_} ; done If the user's shell is not /bin/ksh, then, from the command line, just: ksh for F in tt_* ; do mv $F pe_${F#*_} ; done ; exit Or a shell script executed from any shell: #!/bin/ksh for F in tt_* ; do mv $F pe_${F#*_} ; done What's the use of calling 'expr', 'sed', 'awk', 'cut', etc. a number of times when it can be done all within the shell itself? Show your PATH One solution found on comp.unix.shell the other week that's nicely compact (and is an interesting exercise in shell expansion!) is (for ksh): TILDE='~' PS1='${TILDE[(1-0${PWD%%@([!/]*|$HOME*)}1)]-}${PWD#$HOME}$ ' This will replace $HOME with ~ if its in $PWD (and is the only one (and change) liner I've seen that will do this :)