11-09-2006
script to change filename with numbers
ok, this one is definitely too hard for my shell-script-skills.
Hopefully, there is somebody who can help me with this:
I have a folder with files in it named
0.ppm
10.ppm
2.ppm
...
5.ppm
50.ppm
55.ppm
...
355.ppm
360.ppm
etc.
As you will notice, the order in which the files are processed is not
right, because it should be 5,10,15,20etc. However, because of the
shorter filenames for some of the files, they are sorted in a different
than the mathematical sense.
What I need right now is a script which runs through the data and
checks the filenames. If it is shorter than three, there have to be
zeroes added in front of the number such that I get
005.ppm
010.ppm
015.ppm
020.ppm
and thus a natural way of sorting..
It would be just perfect if anyone could point me in the right
direction.
Thanks so much!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I am newbie and hope that you can help me to rename a file
If I have a file name Perform.01222006.12345.Log now I would like to backup another file with another name like perform-20060112.dat
This is a flat file, and I want to collect some field, then put it in a new file from... (9 Replies)
Discussion started by: sabercats
9 Replies
2. Shell Programming and Scripting
I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies
3. Shell Programming and Scripting
I have some files where numbers are part of like
eg 1add1.txt
23sub41.txt etc
I want to remove numbers from the filenames(whereever it may be).
I used echo `ls *.txt | sed -e "s///"`
But its removing first digits like 1add1.txt becomes add1.txt
My intention is to make 1add1.txt... (3 Replies)
Discussion started by: villain41
3 Replies
4. Shell Programming and Scripting
Hi all,
Can I edit this script:
find . -type f | while read i;do && mv "$i" "${i//abc/}" ;done
so that it will not only take out abc from the filename but also take out any numbers that might be in the filename as well.
An example would be,
Input:
filename abc 2009.mov
Output:... (7 Replies)
Discussion started by: Monkey Dean
7 Replies
5. Shell Programming and Scripting
I have 100 files in a directory with
a.1
a.2
a.3
a.4
How do i remove a. and i need the file names as
1
2
3
4
please help (2 Replies)
Discussion started by: srichunduru
2 Replies
6. Shell Programming and Scripting
Hi guys,
I have a variable where i am storing the filename (with full path).
I just need the value before ".txt". But instead of getting the filename i am getting the contents of the filename.
FileName=/appl/data/Input/US/Test.txt
a=`awk -F"." '{print $1}' ${FileName}`
echo $a... (3 Replies)
Discussion started by: mac4rfree
3 Replies
7. UNIX for Dummies Questions & Answers
Hi
i want to list files based on date and change the date alone in the files in a directory
abc20120101.txt
xyzxyxz20120101.txt
ccc20120201.txt
ddd20120301.txt
In the above i want to select only files having date 20120101 and rename the date for those files like below
abc20111231.txt... (3 Replies)
Discussion started by: Dewdrop
3 Replies
8. Shell Programming and Scripting
I got a game that output map tiles of the session with the 0,0 position at the place you login/spawn.
That makes making a map somewhat troublesome since the 0,0 will move.
So I've been looking for a way to change the numbers in the filenames of all files in a folder by a certain value.
The... (5 Replies)
Discussion started by: Ravenholdt
5 Replies
9. Shell Programming and Scripting
Hi
I have a file with filename as "partition-setup-and-ipl.vtcmd.76217657132.9721536798"
Now i need to move this file as "partition-setup-and-ipl.vtcmd.76217657132.9721536798_org"
i tried with
# ls | grep -E "partition-setup-and-ipl.vtcmd.+"... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
10. Shell Programming and Scripting
Hallo
This is the content of the file
3
4
5
6
7
8
9
10
11
12
And I want the following output
1
2
3
4
5
6
7 (4 Replies)
Discussion started by: thailand
4 Replies
PPMFADE(1) General Commands Manual PPMFADE(1)
NAME
ppmfade - generate a transition between two image files using special effects.
SYNOPSIS
ppmfade [ -f first.ppm ] [ -l last.ppm ] [ -mix|-spread|-shift|-relief|-oil|-edge|-bentley|-block ] [ -base name ]
DESCRIPTION
This program generates a transition between either two input images or between one input image and black. You can use the 30 intermediate
images generated to show a smooth transition between segments of a movie. The input and output images are in the Portable Pixmap (PPM)
format. If you specify both input images, they should both be the same size. If you want to fade from black to an image, specify only the
last image. If you want to fade from an image to black, specify only the first image. ppmfade names the resulting image files base.nnnn
.ppm, where nnnn is a number varying between 0001 and 0030 and base is what you specify with via the -base option (default fade).
Another way to convert by steps from one image to another is morphing. You can use xmorph to do that.
OPTIONS
-f first.ppm
This is the image file (PPM format) to be used at the beginning of the transition. If not specified, the fade will start from
black.
-l last.ppm
This is the image file (PPM format) to be used at the ending of the transition. If not specified, the fade will end with black.
-mix The two images are superimposed with the brightness of the first image decreasing from full to none and the brightness of the final
image increasing from none to full. The transition is quadratic in brightness with faster transition in the beginning and slower at
the end.
-spread
The pixels in the first image will be moved (spread) further and further from their original location and then moved into the proper
location in the final image. This is the default transition.
-shift The pixels in the first image will be shifted further and further horizontally from their original location and then moved into the
proper location in the final image.
-relief
The first image is faded to a Laplacian relief filtered version of the first image. This is then faded to a Laplacian relief fil-
tered version of the second image and finally faded to the final image.
-oil The first image is faded to an "oil transfer" version of the first image. This is then faded to an "oil transfer" version of the
second image and finally faded to the final image.
-edge The first image is faded to an edge detected version of the first image. This is then faded to an edge detected version of the sec-
ond image and finally faded to the final image.
-bentley
The first image is faded to a "Bentley Effect" version of the first image. This is then faded to a "Bentley Effect" version of the
second image and finally faded to the final image.
-block The first image is defocused to small blocks. The small blocks are converted to match a defocused version of the last image. The
block version of the last image is then focused to the final image.
-basename
This forms part of the output filenames, as described above.
EXAMPLES
ppmfade -f teapot.ppm -l pyr.ppm
Fade from teapot.ppm to pyr.ppm generating fade.0001.ppm to fade.0030.ppm using the "spread" transition.
ppmfade -l teapot.ppm
Fade from black to teapot.ppm generating fade.0001.ppm to fade.0030.ppm.
ppmfade -f teapot.ppm -base end
Fade from teapot.ppm to black generating end.0001.ppm to end.0030.ppm.
SEE ALSO
tontsc(1), sgifade(1), smart_vfr(1), xmorph(1), ppm(5),
AUTHOR
Wesley C. Barris (wesb@msc.edu)
Army High Performance Computing Research Center (AHPCRC)
Minnesota Supercomputer Center, Inc.
1 April 1, 2000 PPMFADE(1)