Not long ago, Wade Preston Shearer proclaimed... > I have a directory full of directories that are all named in the > following manner: > > #####_alpha_name > > > I need them renamed to just: > > ##### > > > Is there an easy way via the command line to truncate them to just > the first five characters (which would be just their ID number)?
I'd use the 'cut' command: NEWNAME=`echo $FILE | cut -c1-5` So, perhaps something like this: for FILE in ?????_alpha_name do NEWNAME=`echo $FILE | cut -c1-5` echo "$FILE => $NEWNAME" mv "$FILE" "$NEWNAME" done -- [EMAIL PROTECTED] is Doran L. Barton, president/CTO, Iodynamics LLC Iodynamics: IT and Web services by Linux/Open Source specialists "When a passenger of the foot hove in view, tootle the horn; trumpet at him melodiously at first, but if he still obstacles your passage tootle him with vigor and express by word of mouth warning, 'Hi, Hi.'" -- Seen in a Tokyo traffic handbook
pgp62ujTapgTO.pgp
Description: PGP signature
/* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */