Sponsored Content
Top Forums Shell Programming and Scripting script to change filename with numbers Post 302095810 by aju_kup on Friday 10th of November 2006 09:13:01 AM
Old 11-10-2006
use following

#! /usr/bin/ksh

for fname in `ls *.ppm`
do
wcount=`echo $fname | wc -c`
echo $wcount
if [[ $wcount -eq 6 ]]
then
newfile=00$fname
mv $fname $newfile
fi

if [[ $wcount -eq 7 ]]
then
newfile=0$fname
mv $fname $newfile
fi
#echo $newname
done
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change new filename with date ??

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

gzcat into awk and then change FILENAME and process new FILENAME

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

delete numbers in a filename

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

How to remove numbers from filename

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

Change the filename

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

Change the filename variable value

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

How to change date in a filename?

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

increase/decrease multiple numbers in a filename.

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

Renaming file that has multiple numbers as filename

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

Change numbers

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
winicontoppm(1)                                               General Commands Manual                                              winicontoppm(1)

NAME
winicontoppm - convert a Windows .ico file into 1 or more portable pixmap files SYNOPSIS
winicontoppm [-writeands] [-allicons|-bestqual] [-multippm] [-verbose] [iconfile] [ppmdestfile] DESCRIPTION
Reads a Microsoft Windows .ico file, converts it to one or more ppms. A Windows icon contains 1 or more images, at different resolutions and color depths. Each image has an 'and' mask, which contains transparancy data. By default, the output goes to Standard Output. If you specify ppmdestfile, output goes into one or more files named as follows. If it's just one file (i.e. you specify the -multippm option or don't specify -allicons), the file specification is ppmdestfile.ppm. If it's mul- tiple files, their file specifications are ppmdestfile_1.ppm, ppmdestfile_2.ppm, etc. When you specify the -writeands option, the filenames above are modified to include the string xor as in ppmdestfile_xor.ppm or ppmdest- file_xor_1.ppm. winicontoppm can convert images with 1, 4, 8, 24 or 32 bits per pixel (bpp). OPTIONS
-writeands For each icon written, also write the 'and' (transparancy) mask as a seperate PBM file. It's name is of the form ppmdest- file_and.pbm or ppmdestfile_and_1.pbm. -allicons Extract all images from the .ico file. -bestqual Extract only the best quality (largest, then highest bpp) image from the .ico file. -multippm Write all ppms to a single file. SEE ALSO
ppmtowinicon(1), ppm(5) AUTHOR
Copyright (C) 2000, 2003 by Lee Benfield. 22 May 2000 winicontoppm(1)
All times are GMT -4. The time now is 03:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy