Re: basic issue/question -- renaming in mass a bunch of files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 24 Feb 2018, Ed Greshko wrote:

> On 02/24/18 22:03, bruce wrote:
> > Hi.
> >
> > Have a bunch of files with the basic naming of:
> > ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> > ztcloud_nfs_parseztaa_1__WGS_7500_002__parse.dat
> > etc..
> >
> > I'd like to simply remove the 1st part ztcloud_nfs_parsezt from the
> > files, renaming the files to the rest of the filename..
> >
> > Thought it should be simple using rename
> >
> > rename 's/ztcloud_nfs_parseztaa/aa/' zt*.dat
> >
> > However, this didn't work... so.. hmm..
> >
> > How would you guys solve this?
> >
> > SO has a bunch of different solns as well.
>
> If I understand correctly you want ztcloud_nfs_parseztaa_1__WGS_7500_001__parse.dat
> renamed to aa_1__WGS_7500_001__parse.dat, etc?
> And all the files follow the pattern with the same length?
>
> If so, the simple script
>
> #!/bin/bash
>
> for file in *dat
>
> do
> name=`echo $file | cut -c20-48`
> mv $file $name
> done
>
> does it.

  fedora has a "rename" command that would seem to be designed for
just this sort of thing.

rday
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux