bash script for managing database
Posted on 2008-10-16
I have two questions here:
(First question) basically I have a bunch of files
1.txt 2.txt 3.txt ... 100.txt and each of them is some results of
calculation done with a parameter "N".
1.txt is done with N=0.99, 2.txt is done with N=0.97, 3.txt is done
with N=0.9 4.txt is done with N=0.89...
As you can see, the filenames are named according to the sort of
parameter N. The relation is recorded in a file called ./summary:
Now I am generating a file with N=0.98 in the very same folder. I
want to rename all the files such that the filename still represents
the order of N, besides, I also want to update ./summary so the new N--
filename relation is updated.
(Namely, I want the new ./summary file to be
In some other folders I have 1.gif 2.gif 3.gif .... x.gif (x differs from case to case),
and I am about to generate yet another
gif file. The newly generated gif file is always named "new.gif"
This time I simply want bash to find the biggest number "x" of the
files, and rename my new.gif to $((x+1)).gif.
What shall I do?