Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Joe
I think the following script will for for your pattern. -- CUT HERE --- #!/bin/bash # To rename ccna.pod1.pc1.ext is renamed to ccna.pod2.pc1.ext for file in $(ls ccna*ext | sort -rn -k 1.9) do let ix=$(echo $file | sed -e 's/.*pod//' -e 's/.pc..ext//') let iy=$ix+1

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Joe
That is what my script does. The sort -rn -k 1.9 says, sort reverse numeric with key 1 character position 9. I also check to make sure that another file is not dropped in there during processing of the script. Dazed_75 wrote: On Mon, Feb 16, 2009 at 5:33 PM, Dennis Kibbe

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Stephen P Rufle
Is there a way to single step bash script to inspect what is going on? I have preferred python for this reason. I write what I think will work in eclipse and then run it once single stepping in debug mode to make sure what I meant is what is actually happening. Joe wrote: That is what my script

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Eric Shubert
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html Stephen P Rufle wrote: Is there a way to single step bash script to inspect what is going on? I have preferred python for this reason. I write what I think will work in eclipse and then run it once single stepping in debug mode to

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Dennis Kibbe
Actually, if the original specification is co= rrect, probably none of the solutions proposed is likely to work.nbsp; It = appears that the target name for the first rename is the same as the source= for the second.nbsp; If this were true one would have to ensure that rena= me or move operations

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Matt Graham
From: Stephen P Rufle stephen.p.ru...@cox.net Is there a way to single step bash script to inspect what is going on? When I need copious debugging output from a bash script, I put set -x at the top of the file. When I need to check the syntax for a script, I do sh -n file.sh. Someone else

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Alex Dean
On Feb 17, 2009, at 11:38 AM, Dennis Kibbe wrote: Actually, if the original specification is co= rrect, probably none of the solutions proposed is likely to work.nbsp; It = appears that the target name for the first rename is the same as the source= for the second.nbsp; If this were true

RE: bulk rename pod1 pod2 needed

2009-02-17 Thread Bob Elzer
[mailto:plug-discuss-boun...@lists.plug.phoenix.az.us] On Behalf Of Alex Dean Sent: Tuesday, February 17, 2009 12:47 PM To: Main PLUG discussion list Subject: Re: bulk rename pod1 pod2 needed On Feb 17, 2009, at 11:38 AM, Dennis Kibbe wrote: Actually, if the original specification is co= rrect, probably

Re: bulk rename pod1 pod2 needed

2009-02-17 Thread Kevin Spencer
On Mon, Feb 16, 2009 at 5:33 PM, Dennis Kibbe denn...@sdf.lonestar.org wrote: Can someone suggest a way to rename a directory of files like this: ccna.pod1.pc1.ext is renamed to ccna.pod2.pc1.ext ccna.pod2.pc1.ext is renamed to ccna.pod3.pc1.ext and so on. (Aside: Hans, if I were able to

bulk rename pod1 pod2 needed

2009-02-16 Thread Dennis Kibbe
Can someone suggest a way to rename a directory of files like this: ccna.pod1.pc1.ext is renamed to ccna.pod2.pc1.ext ccna.pod2.pc1.ext is renamed to ccna.pod3.pc1.ext and so on. (Aside: Hans, if I were able to take your scripting class I won't be asking this now. :-) Dennisk -- Free as in

Re: bulk rename pod1 pod2 needed

2009-02-16 Thread James Mcphee
assuming you're just trimming off ccna, pc1, and ext for i in $( ls ) do mv $i $( echo $i | awk -F. '{ print $3 }' ) done That would move them to pod# names. On Mon, Feb 16, 2009 at 5:33 PM, Dennis Kibbe denn...@sdf.lonestar.orgwrote: Can someone suggest a way to rename a directory of files

RE: bulk rename pod1 pod2 needed

2009-02-16 Thread Lisa Kachold
%s.%s\n, $0, substr($2,1,length($2)-1), s, $3)} ' | sh obnosis.com | wiki.obnosis.com| (503)754-4452 PLUG HACKFESTS 2nd Saturday Each mo...@noon - 3PM Date: Mon, 16 Feb 2009 17:36:58 -0700 Subject: Re: bulk rename pod1 pod2 needed From: jmc...@gmail.com To: denn...@member.fsf.org; plug-discuss

RE: bulk rename pod1 pod2 needed

2009-02-16 Thread Lisa Kachold
Course 'man rename' will work also obnosis.com | wiki.obnosis.com| (503)754-4452 PLUG HACKFESTS 2nd Saturday Each mo...@noon - 3PM Date: Tue, 17 Feb 2009 00:33:38 + From: denn...@sdf.lonestar.org To: plug-discuss@lists.plug.phoenix.az.us Subject: bulk rename pod1 pod2