incremental by 1


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers incremental by 1
# 1  
Old 09-29-2009
incremental by 1

let says, i have this number as 000002080, i want to add 1 to make it 000002081, and then i want to add 1 to 000002082, add 1 to 000002083, 84.

i=000002080
TOT=$(echo "scale=9; $i + 1" | bc)
echo $TOT

it shows 2081, i want to retain 000002081, 000002082, 000002082, 000002084.
# 2  
Old 09-29-2009
Code:
$ i=000002080
$ tot=$(printf "%09d" $((i+1)))
$ echo $tot
000002081

# 3  
Old 09-29-2009
thank you much, exactly what i want. again, thanks.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Search and incremental replace

Dears, Can you help me with the below concern, I need one liner for this. Input_file.txt dn: asdf=yyyyyyyyyyyyy426019001711473,ou=multiSCs,dc=btc asdf: yyyyyyyyyyyyy426019001711473 DSUnitGroup: 1 objectClass: CUDBMultiServiceConsumer dn:... (1 Reply)
Discussion started by: Kamesh G
1 Replies

2. UNIX for Beginners Questions & Answers

Incremental logic

Hi Guys, am trying to write logic to do incremental value using linux Example: a=00.00.00.01 My b should be like this b=00.00.00.02 and when it reaches 99 my b should look like this b=00.00.01.99 Appreciate your help guys Please use CODE tags when displaying sample input, sample... (14 Replies)
Discussion started by: buddi
14 Replies

3. UNIX for Dummies Questions & Answers

Create an incremental tar

Hello, I need to create a tar file with a list of files from a directory. The directory has about 1000+ files of which I only need to create a tar ball of 150 files. The 150 files I need in the tar ball do not have common names or a common start letter. No two file names match, example: 1st... (3 Replies)
Discussion started by: babyPen1985
3 Replies

4. Shell Programming and Scripting

Incremental numbering?

Would it be possible for a script to duplicate a file and incrementally number it? File in: XXX_007_0580_xxxx_v0016.aep File out: XXX_007_0580_xxxx_v0017.aep If someone knows of a way I'd love to see it. Thanks! (7 Replies)
Discussion started by: scribling
7 Replies

5. UNIX for Dummies Questions & Answers

incremental and full backup.. please help me

Hi, i'm new here(and a newbie) and i need some help with a project. I need to write a script for an incremental backup (this must be executed every day at 24:00) and a full backup (executed once a month) for etc/var/home directories. Can someone please help me with this? And a small explanation of... (9 Replies)
Discussion started by: bender-alex
9 Replies

6. Shell Programming and Scripting

FULL or INCREMENTAL ???

Hi. Can someone tell me if the following script that i have made is a script for INCREMENTAL BACKUP or FULL BACKUP. My teacher told me that is doing an FULL BACKUP. • find /etc /var /home -newer /backups/.backup_reference > /backups/.files_to_archive • touch /backups/.backup_reference • tar... (1 Reply)
Discussion started by: bender-alex
1 Replies

7. Windows & DOS: Issues & Discussions

Incremental Backup

I have a folder /root/test in a centos 5.3 system. I want to take an incremental backup of the contents of the folder in the C:\Downloads folder of a windows system present in the same lan as the linux system. What are the ways of executing this plan? Kindly help (0 Replies)
Discussion started by: proactiveaditya
0 Replies

8. Shell Programming and Scripting

Incremental backup

Hi, I would like to create a daily incremental backup of a directory with all of the files within and add a timestamp (year-month-day) to the tar.gz file. I have the following, but it doesn't backup the inside files of the directory. #!/bin/bash tar -czf... (1 Reply)
Discussion started by: agasamapetilon
1 Replies

9. UNIX for Dummies Questions & Answers

incremental backup

Hi All.. i am trying to write a script which will give the incremental tar backup of all files with latest timestam. i tried with find -mmin -2 but if it takes half on hour or something to creat the tar itself, then no meaning in using the above command. so please help me to find the... (2 Replies)
Discussion started by: Usha Shastri
2 Replies
Login or Register to Ask a Question