On Dec 13, 2010, at 4:55 PM, James Stroud wrote:
>
> On Dec 13, 2010, at 2:39 PM, Francis E Reyes wrote:
>> What gives me the willies is using mv... it's so .. permanent... and would
>> drive my spotlight indexer nuts .
>>
>> I go for symlink :)
>
> Symlink fails for the renaming function, f,
On Dec 13, 2010, at 2:39 PM, Francis E Reyes wrote:
> What gives me the willies is using mv... it's so .. permanent... and would
> drive my spotlight indexer nuts .
>
> I go for symlink :)
Symlink fails for the renaming function, f, when f(name_i) == name_j if
renaming a set of files containing
Bill Scott probably has some zsh slickness to do the same thing
without
the loop, but too much magic gives me the willies.
What gives me the willies is using mv... it's so .. permanent... and
would drive my spotlight indexer nuts .
I go for symlink :)
F
-
Hi Ed,
> does this assume that the current folder contains only the files to be
> renamed?
Indeed it does. I was aiming to show that for simple tasks like this,
a modern shell makes things easy enough that scripts become overkill.
> Also, how does one add padding zeros?
You can just add in a
Ben,
does this assume that the current folder contains only the files to be
renamed? Also, how does one add padding zeros?
While Donghui didn't need zero padding, my one liner can be easily
corrected to do this in the same way Ian's is, by replacing
%d with %0nd, where n is the total number of
Assuming that your files are named something_.img what follows must
be one line):
echo | awk '{for(i=361;i<721;i++) printf "mv something_%d.img something_
%d.img\n",i+720,i;}' | bash -sf
I'd try first without piping it to bash just to make sure that it works
right.
On Fri, 2010-12-10 at 09:5
Quickie 1-liners are also possible in Perl, and it's a lot more
flexible than awk to boot:
perl -e 'for(<*>) {rename $_,$1.($2-720).$3 if /(.+?)(\d+)(.img)$/}'
This (as well as I suspect some of the shell scripts posted) would
fail if you had asked to rename to the range 001..360 since the
leadin
> #! /bin/csh -f
That's your problem right there! You don't need a script at all.
In bash/ksh/zsh right on the command line:
c=361 && for f in * ; do mv $f CD267A_3_pk_1_$c.img ; c=$(($c+1)) ; done
Bill Scott probably has some zsh slickness to do the same thing without
the loop, but too much
#! /usr/bin/env python
import os
import sys
try:
start = int(sys.argv[1])
total = int(sys.argv[2])
correction = int(sys.argv[3])
template = sys.argv[4]
except (IndexError, ValueError):
command_name = os.path.basename(sys.argv[0])
print "usage: %s start total correction template" % com
This script will not work.
Try this:
#! /bin/csh -f
set i = 1081
while ( $i <=1440 )
set n = `echo $i | awk '{print $i-720}'`
echo mv CD267A_3_pk_1_$i.img CD267A_3_pk_1_$n.img
@ i++
end
Thanks
Abhinav
j...@ssrl, SLAC
Phone: (650) 926-2992
Fax: (650) 926-3292
On Dec 9, 2010, at 5:51
Dear all,
I need a script to renumber my image. My initial image number ranges from
*_1081.img to *_1440.img. There are 360 images in total. I want to renumber
these images with the ranges from *_361.img to *_720.img, that means every
initial image-720, but I don't know how to do it. Below is my s
11 matches
Mail list logo