Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Substract a certain number to the names of several files Post 302384075 by Epictete on Monday 4th of January 2010 07:49:02 PM
Old 01-04-2010
Oh yes, exactly what I needed for understanding the scripts; I didn't find anything about the meaning of %% and ##. Now I've got a lot to do! I'm gonna read that. Thank's!

---------- Post updated at 01:37 AM ---------- Previous update was at 01:34 AM ----------

So that one doesn't have to adapt the script to the first number of the photos, it's better to add the 3 first lines:

Code:
echo -n "Enter the number of the first photo: "
read num
ls | while read name
do
  ext=${name##*.}
  first=${name%.*}
  pre=${first%%[0-9]*}
  nr=${first##*[^0-9]}
  newnr=$(printf "%03d" $((nr-num+1)))
  mv "$name" "${pre}${newnr}.${ext}"
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

total number of files which have "aaa" in files whose names are File*_bbb*

I am getting the list of all the files which have "aaa" from files whose name is File*_bbb*. grep -l "aaa" File*_bbb* But I want to count the number of files. That is I want the total number of files which have "aaa" in files File*_bbb* If I run the following for getting number of... (1 Reply)
Discussion started by: sudheshnaiyer
1 Replies

2. Shell Programming and Scripting

Finding files with names that have a real number greater then difined.

I am trying to find all files in a directory whose name has a real number larger then the number I am looking for. For example: . |-- delta.1.5.sql |-- delta.2.1.sql |-- delta.2.2.sql |-- delta.2.3.sql |-- delta.2.4.sql `-- delta.2.5.sql I know my database is at 2.2 so I want an... (2 Replies)
Discussion started by: harmonwood
2 Replies

3. Shell Programming and Scripting

Find the number of non-duplicate names recursively.

Hi, here comes another newbie question: How to find the number of non-duplicate names recursively? For example, my files are stored in the folders like: If I do find . -depth -name "*.txt" | wc -l This will gives out a result "4". One .txt file named "1.txt" in folder "1", and... (2 Replies)
Discussion started by: jiapei100
2 Replies

4. Solaris

Substract time between two columns

I've start and end time in two columns. How can I substract time from column 2 and column 1 and receive output in another file 'd' ? $ cat c 12:55:04 2:03:56 2:03:56 3:20:17 14:00:00 13:05:00 (1 Reply)
Discussion started by: alps0206
1 Replies

5. Shell Programming and Scripting

Substract and print

Dear all, I need your help. I have file input like this: input.txt: R1031 50111G1 R1031 50121G1 R1031 50131G1 R1031 50141G1 R1031 50151G1 . . . . Desired output: 10315011 = G, 10315012 =... (2 Replies)
Discussion started by: attila
2 Replies

6. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

7. Shell Programming and Scripting

Substract 1 Month from MonthID

Hi, I am writing a small unix command to substract one month from the MonthID. If MonthID = 201301 the below script returns me 201212 if ] then a=`echo $monthid | cut -c1-4` b=`expr $a - 1` c=12 echo "$b$c" else a=`echo $monthid | cut -c5-6` b=`expr $a - 1` c=`echo $monthid | cut... (4 Replies)
Discussion started by: pinnacle
4 Replies

8. Shell Programming and Scripting

Compare two files containing package names and version number

I have 2 files each containing a list of same fedora packages but with different version number. I want to compare the 2 files and remove the lines containing a newer or older version number (1 Reply)
Discussion started by: asya18
1 Replies

9. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

10. Shell Programming and Scripting

Sorting a column according to the number of names

Hey, So I'm having issues sorting a data set. The data set contains entries as such; # key: sex, time, athlete, athlete's nationality, date, city, country M, 2:30:57.6, Harry Payne, GBR, 1929-07-05, Stamford Bridge, England M, 2:5:42, Khalid Khannouchi, MAR, 1999-10-24, Chicago, USA M,... (1 Reply)
Discussion started by: DNM_UKN
1 Replies
TCRMGR(1)							   Tokyo Tyrant 							 TCRMGR(1)

NAME
tcrmgr - the command line utility of the remote database API DESCRIPTION
The command `tcrmgr' is a utility for test and debugging of the remote database API and its applications. `host' specifies the host name of the server. `key' specifies the key of a record. `value' specifies the value of a record. `params' specifies the tuning parameters. `dpath' specifies the destination file. `func specifies the name of the function. `arg' specifies the arguments of the function. `file' specifies the input file. `upath' specifies the update log directory. `mhost' specifies the host name of the replication master. `url' specifies the target URL. tcrmgr inform [-port num] [-st] host Print miscellaneous information to the standard output. tcrmgr put [-port num] [-sx] [-sep chr] [-dk|-dc|-dai|-dad] host key value Store a record. tcrmgr out [-port num] [-sx] [-sep chr] host key Remove a record. tcrmgr get [-port num] [-sx] [-sep chr] [-px] [-pz] host key Print the value of a record. tcrmgr mget [-port num] [-sx] [-sep chr] [-px] host [key...] Print keys and values of multiple records. tcrmgr list [-port num] [-sep chr] [-m num] [-pv] [-px] [-fm str] host Print keys of all records, separated by line feeds. tcrmgr ext [-port num] [-xlr|-xlg] [-sx] [-sep chr] [-px] host func [key [value]] Call a script language extension function. tcrmgr sync [-port num] host Synchronize updated contents with the database file. tcrmgr optimize [-port num] host [params] Optimize the database file. tcrmgr vanish [-port num] host Remove all records. tcrmgr copy [-port num] host dpath Copy the database file. tcrmgr misc [-port num] [-mnu] [-sx] [-sep chr] [-px] host func [arg...] Call a versatile function for miscellaneous operations. tcrmgr importtsv [-port num] [-nr] [-sc] host [file] Store records of TSV in each line of a file. tcrmgr restore [-port num] [-ts num] [-rcc] host upath Restore the database with update log. tcrmgr setmst [-port num] [-mport num] [-ts num] [-rcc] host [mhost] Set the replication master. tcrmgr repl [-port num] [-ts num] [-sid num] [-ph] host Replicate the update log. tcrmgr http [-ah name value] [-ih] url Fetch the resource of a URL by HTTP. tcrmgr version Print the version information of Tokyo Tyrant. Options feature the following. -port num : specify the port number. -st : print miscellaneous status data. -sx : input data is evaluated as a hexadecimal data string. -sep chr : specify the separator of the input data. -dk : use the function `tcrdbputkeep' instead of `tcrdbput'. -dc : use the function `tcrdbputcat' instead of `tcrdbput'. -dai : use the function `tcrdbaddint' instead of `tcrdbput'. -dad : use the function `tcrdbadddouble' instead of `tcrdbput'. -px : output data is converted into a hexadecimal data string. -pz : do not append line feed at the end of the output. -m num : specify the maximum number of the output. -pv : print values of records also. -fm str : specify the prefix of keys. -xlr : perform record locking. -xlg : perform global locking. -mnu : omit the update log. -nr : use the function `tcrdbputnr' instead of `tcrdbput'. -sc : normalize keys as lower cases. -mport num : specify the port number of the replication master. -ts num : specify the beginning time stamp. -rcc : check consistency of replication. -sid num : specify the self server ID. -ph : print human-readable data. -ah name value : add a request header. -ih : output response headers also. If the port number is not more than 0, UNIX domain socket is used and the path of the socket file is specified by the host parameter. This command returns 0 on success, another on failure. SEE ALSO
ttserver(1), ttultest(1), ttulmgr(1), tcrtest(1), tcrmttest(1), ttutil(3), tcrdb(3) Man Page 2010-01-20 TCRMGR(1)
All times are GMT -4. The time now is 09:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy