Moving files which are generating time to time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Moving files which are generating time to time
# 1  
Old 02-15-2009
Error Moving files which are generating time to time

Hi all,

I always getting great response from this forum, that why i am putting again....

I am working in a company which is giving ATM support.In one of my production server a lot of files are getting generated every day. I want to move these files to another name.

The file name which is generating is something like "67234.KBL.121.ejournal.20090208_2256.txt", in which '121' is ATM UNIQUE ID. A lot of files are generating every day with different UNIQUE ID. There is a corresponding TERM ID for each unique ID.
Suppose UNIQUE ID 121 is having a term ID like "KBL1201" . The same way there is more than 150 UNIQUE ID's and its corresponding TERM ID's

So my ultimate aim is to change the file name to something like "KBL1201.DATE.txt" ie, files should change it's name corresponding to its TERM ID.

Thanks in advance
Renjesh Raju
# 2  
Old 02-15-2009
Hello Renjesh

I understood your problem but before offering you any solution i would like to know whether there is a flat file which contains the mapping of unique id(ATM id) to terminal id.

If there is a flat file for the mapping. Please post it contents for reference.
# 3  
Old 02-15-2009
Thank you for your reply

Yes i have a flat file which can link b/w TERM ID and UNIQUE ID.

For e.g .. (Content of the file is like )

121,KBL1201
132,KBL0321
145,KBL2100
......... and so on

Thanks
Renjesh Raju
# 4  
Old 02-15-2009
Something like this would work for you

for i in `ls xyz`
do
ATM_ID=`cut -d"." -f3 $i`
TERM_ID=`grep $ATM_ID flat.txt|cut -d"," -f2`
mv $i ${TERM_ID}.DATE.txt
done

flat.txt is the file containing the mapping of ATM id and unique id
I am assuming that your files are getting generated in xyz dir.
# 5  
Old 02-18-2009
Thank you for your reply...

Anyway still i am not getting the output. The script is throwing an error like
Cannot read the file (It is not able to read the file properly)

Thanks
Renjesh Raju
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

modifying date and time and time zone on solaris 5.10 with (redundant server) veritas

I have a cluster of two Solaris server (veritas cluster). one working and the other is standby I am going to change the date on them , and am looking for a secure solution as it is giving an important service. my opinion is that the active one doesn't need to be restarted (if I don't change the... (1 Reply)
Discussion started by: barry1946
1 Replies

2. Shell Programming and Scripting

Converting date/time and generating offsets in bash script

Hi all, I need a script to do some date/time conversion. It should take as an input a particular time. It should then generates a series of offsets, in both hour:minute form and number of milliseconds elapsed. For 03:00, for example, it should give back 04:02:07 (3727000ms*) 05:04:14... (2 Replies)
Discussion started by: emdan
2 Replies

3. Shell Programming and Scripting

Moving files only by oldest file one at a time

Hi I am want to create a script where the file gets moved from the current folder to a folder transfer based on the oldest first. This script should run one file at a time using a loop. I want it as a loop because I want to do some processing while I have one file. Can anyone guide me on this? (2 Replies)
Discussion started by: chamajid
2 Replies

4. Shell Programming and Scripting

Moving the files based on count and time.

Hi, I have a requirement ,let us say 1000 files needs to be transferred in an hour from one path to another path and if the files (1000 files) are transferred within an hour ( say 40 mins), then the process should remain idle for the remaining time ( 20 mins). (3 Replies)
Discussion started by: Asaikarthik
3 Replies

5. Shell Programming and Scripting

generating a sequence depending on the time of the day

ould we generate a sequence number based on the time of the day? e.g. an application is scheduled to run from 0800 hrs to 1700 hrs with a frequency of Once every five minutes the intention is to "assign" a certain value to a variable when depending on the time of the day i.e. if the time... (6 Replies)
Discussion started by: zainravi
6 Replies

6. Shell Programming and Scripting

Finding files older than the current date and time and renaming and moving

Hi, I have a very urgent requirement here. I have to find all files in the specified directory but not in the sub directories(The directory name is stored in a variable) which are older than the current date as well as current time and rename it as filename_yyyymmddhhmmss.ext and move it into a... (7 Replies)
Discussion started by: ragavhere
7 Replies

7. Shell Programming and Scripting

generating reports based on time field of network data

hi i have data extracted in the following format ranging around 300000 to 800000 records in a text file , the format is of network data . No. Time Source Destination Protocol 1 1998-06-05 17:20:23.569905 HP_61:aa:c9 HP_61:aa:c9 ... (1 Reply)
Discussion started by: renukaprasadb
1 Replies

8. Shell Programming and Scripting

Generating files with time interval of fifteen minutes

Hi Guys, I have two dates as start date and end date.. i need to generate files within these two dates with time interval of half an hour.... i.e. Start Date=25/09/07 12:00:00 End Date=26/09/07 12:00:00 Now i need to generate files every half an... (0 Replies)
Discussion started by: aajan
0 Replies

9. UNIX for Advanced & Expert Users

How To Provide Time Sync Using Nts-150 Time Server On Unix Network?

can anybody tel lme,how to instal NTS -150 on a unix network,it needs some patch to fetch time frm serve,,?? (2 Replies)
Discussion started by: pesty
2 Replies
Login or Register to Ask a Question

Featured Tech Videos