[plug] Renaming files

Steve Grasso steveg at calm.wa.gov.au
Sat Apr 6 10:34:25 WST 2002


Paul,

The following quick kludge will do the job.
The script must be run in the current directory and has no error checking or 
other intelligence, so use with care. Ignore the complaint from mv at the end:

-----------------8<-----------------------
#!/bin/sh
for i in *
do
    echo $i | awk '{print substr($i,36)}' | xargs mv -f $i
done
-----------------8<-----------------------

Regards,
Steve

On Fri, 5 Apr 2002 20:07, Paul Dean wrote:
> Hya all,
>
> Just wondering if you can help.
>
> I would like to rename a large number of files by stipping of the first
> 35 chars.
>
> Short of writing a script to do this, is there a way it can be done from
> the console using find/ls/cut etc, I know it can be done with sed/awk
> but I've not had a lot of success with them (lack off experience)
>
> So if someone could point me in the right direction would be much
> appreciated.



More information about the plug mailing list