|
vi srv_request.unl 10157|984|0|0|A|1234|time stamp = 2009-02-21 02:11:56|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| 10158|984|0|0|A|1234|time stamp = 2009-02-21 02:31:16|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| 10159|984|0|0|A|1234|time stamp = 2009-02-21 03:19:16|370987678901206|Card is already hot in PPS, error in 10.248.11.33, 10.248.11.33 and 10.248.11.33| 10160|969||0|A|111|time stamp = 2009-02-21 03:23:57|345353453453453454|Card is already hot in PPS, error in 10.248.11.33, 10.248.11.33 and 10.248.11.33| 10161|984|0|0|A|1234|time stamp = 2009-02-21 04:25:50|370987678901206|Card is already hot in PPS, error in 10.248.11.33, 10.248.11.33 and 10.248.11.33| 10162|984|0|0|A|1234|time stamp = 2009-02-21 04:27:37|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| 10163|984|0|0|A|1234|time stamp = 2009-02-21 04:50:46|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| 10164|984|0|0|A|1234|time stamp = 2009-02-21 05:05:48|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| 10165|985||0|A|12345|time stamp = 2009-03-18 01:32:56|1234567890|Card is Hotted in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72: HOT| 10166|986||0|D|ferant r|time stamp = 2009-03-18 01:42:4 |regemque dedit|Card is already unhot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.| The above data is unloaded from a table named srv_request and unloaded to a file called srv_request.unl using the following command UNLOAD TO srv_request.unl SELECT * FROM srv_request What I have to do is to write shell Program which checks for every row of data in the srv_request.unl file and checks for the time stamp label and decrement the time by 1 hour which is followed by the time stamp label For example for the first row of data 10157|984|0|0|A|1234|time stamp = 2009-02-21 02:11:56|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72| the time stamp = 2009-02-21 02:11:56 so it should be decremented by one hour and the new time stamp should become time stamp = 2009-02-21 01:11:56 After every row data the time stamp decrementation is acieved then the corresponding data will be inserted to srv_request table. Inserting the data back to the table is simple that can be acieved by following statement LOAD FROM srv_request.unl INSERT INTO srv_request The main headache is in writing the logic for reading each row of data of the file(i.e srv_request.unl) and for each row i need to check for the time stamp label then decrement the time by 1 hour. Remember I am using Informix Dynamic Server Version 9.40.FC9 and operating System is Unix (HP-Ux) I know how to read line by line in a file which is something like this while read line do echo $line done < "myfile" the problem lies in checking for the string "time stamp" and decrementing the time followed by the string "time stamp" for example 10157|984|0|0|A|1234|time stamp = 2009-02-21 02:11:56|370987678901206|Card is already hot in PPS, error in 10.248.11.72, 10.248.11.72 and 10.248.11.72|
|