Re: pattern matching rename...

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

 



Sure there are 100's of ways...
here's one:

for i in `ls abc*`; do NAME=`echo $i | cut -f1 -d.`; EXT=`echo $i | cut -f2 -d.`; NEW_NAME=${NAME}_dog.${EXT}; cp $i $NEW_NAME; done
(of course to rename, you would want 'mv' instead of 'cp' )

-b

bruce wrote:
i have the following as a test...

abcCAT.py
abcCAT.txt

i'd like to rename the files, so i get
abcCAT_dog.py
abcCAT_dog.txt

i've been trying to figure out how to achieve what i want using rename and
pattern matching.. i'm missing something.. and it's simple!!

any thoughts/pointers?

thanks



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

  Powered by Linux