Set a variable that changes every time?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Set a variable that changes every time?
# 1  
Old 10-16-2008
Set a variable that changes every time?

Do not know how to do this, any help would be appreciated:

I have a file that comes in called xxxx.txt. I have a script that does some messing around with the file.

The file needs to go out as PAB108XXXX.csv

The four x's above will be a number that changes everytime the script is ran e.g.

1st run

PAB1081234.CSV

2nd run

PAB1081235.CSV

I need it to increase by one everytime? can this be set in a variable that will increase by one everytime?Smilie
# 2  
Old 10-16-2008
Pablo_beezo,

keep the xxxx value in separate file (Inc.csv). while the script starts, read the content in that file and increament by one. At the end of the script move the incremented value to the file (Inc.csv).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Time out set in perl script

Hi, I am preparing a perl script, which will run some commads on remote Linux servers. I have a file contains all the servers names one by one like below vi servers.txt srv1 srv2 srv3 Now, I need to prepare a perl script to ssh (or)rsh to each server in the above... (1 Reply)
Discussion started by: kumar85shiv
1 Replies

2. HP-UX

What is the use of command set -- and set - variable?

Hi, I am using hp unix i want to know the use of the following commands set -- set - variable thanks (4 Replies)
Discussion started by: gomathi
4 Replies

3. Shell Programming and Scripting

How to set crontab for different Time Zone

Hi, I want to set cron job for different time zone from my machine. So here is what I did to set it. I am having a file cronfile, which I use to set cron jobs by using Crontab cronfile Now in cronfile I set TZ variable as Set TZ=Asia/Calcutta But now... (3 Replies)
Discussion started by: sarbjit
3 Replies

4. UNIX for Dummies Questions & Answers

How do i set time in 24 hour format?

Currently whenever i run date command output is shown like Mon Apr 12 05:17:21 IST 2010 When its 17:17 Here. How would i change it so that it should show. Mon Apr 12 17:17:21 IST 2010 (8 Replies)
Discussion started by: pinga123
8 Replies

5. UNIX for Dummies Questions & Answers

How can I set save daylight time

Hi everybody... I am using IBM unix server . Server take time options from satellite but server is not include true setting . What can I do? (2 Replies)
Discussion started by: deox
2 Replies

6. Shell Programming and Scripting

I need to set a time limit for a script

Hello Folks, I have been asked to write a test script which can be run by students. the script should have a time limit. I have almost completed it except the bit of timing! I've seen something like this: on_timeout() { echo "$USER $score " >> theresult.txt echo "Time out!... (2 Replies)
Discussion started by: SultanKSA
2 Replies

7. Shell Programming and Scripting

set variable with another variable? c shell

okay, this shouldn't be difficult but I can't figure it out. How can I set a variable with another variable. I have the following: foreach pe ($dir $sp) set tpe = `echo $pe | grep M` if ($tpe == M) then set ${$pe} = M <--- This doesn't work else endif end In this case what... (2 Replies)
Discussion started by: wxornot
2 Replies

8. UNIX for Advanced & Expert Users

Solaris 9: How to set time/Synchronize

Hi, I have 4 solaris 9(32-Bit) Sparc machines on the same subnet. All 4 of them have different times( off by 10-15 mins). I need to synchronize all 4 of them. Please advise what I should do to sync them to the proper time, and with each other. Thanks (3 Replies)
Discussion started by: 0ktalmagik
3 Replies

9. UNIX for Dummies Questions & Answers

Export command giving Variable Name vs the Value set for the Variable

I'm having an issue when I export within my program. I'm getting the variable name, not the variable value. I have a configuration file (config.txt) that has the values of the variables set as so: set -a export ARCHIVEPOSourceDir="/interfaces/po/log /interfaces/po/data" export... (2 Replies)
Discussion started by: ParNone
2 Replies

10. UNIX for Advanced & Expert Users

how to set the environment variable at run time

hi, I have one environment variable like path in my system.But in my program i need to change that path .suppose it has a value "config" now i need to chage it as "config1" or something else.i need to use that variable for complete project.It means at first it will use the old path but after... (4 Replies)
Discussion started by: sada@123
4 Replies
Login or Register to Ask a Question