[plug] Renaming files

Paul Dean paul at canningcollege.wa.edu.au
Mon Apr 8 18:32:13 WST 2002


On Mon, 8 Apr 2002, Steve Grasso wrote:

> It's actually cut -b 36- since the count begins at 0
Ok then it was my mistake, I needed to cut from 0 -> 34 = 35 chars.
but "cut -b 35-" was the correct param that I needed.
but now all done Thanks everyone for your help.

the final line was...

for i in *mp3; do mv "$i" "echo $i | cut -d 35-"; done

TIA
> 
> Regards,
> Steve
> 
> On Sat, 6 Apr 2002 20:33, Leon Brooks wrote:
> > On Friday 05 April 2002 08:07 pm, Paul Dean wrote:
> > > I would like to rename a large number of files by stipping of the first
> > > 35 chars.
> > >
> > > So if someone could point me in the right direction would be much
> > > appreciated.
> >
> > for x in *; do mv -v "$x" "$(echo $x | cut -b 35-)"; done
> >
> > The -v is optional, makes mv tell you what it's doing, the 35- says print
> > char 35 and on, if it doesn't work out at the right spot, change this.
> >
> > Cheers; Leon
> 

-- 
Paul Dean.
Canning College IT Support.



More information about the plug mailing list