Sponsored Content
Top Forums Shell Programming and Scripting Help building the logic for a script Post 302212761 by fahadaizaz on Tuesday 8th of July 2008 09:18:52 AM
Old 07-08-2008
Help building the logic for a script

Hi guys,

I am new to shell scripting, i need your help to tackle a problem.
I have a single file, sample is below:

Code:
2008:07:08 07:01:14.360 (tid 4) INFO no bonus notifications to send
2008:07:08 07:01:50.823 (tid 1) INFO Database cleaned of all stale bonus records order than 30 days
2008:07:08 07:01:50.823 (tid 1) INFO No files matching the pattern were found
2008:07:08 07:02:14.770 (tid 4) INFO no bonus records to credit
2008:07:08 07:02:14.770 (tid 4) INFO no bonus notifications to send
2008:07:08 07:02:51.309 (tid 1) INFO Database cleaned of all stale bonus records order than 30 days
2008:07:08 07:02:51.309 (tid 1) INFO Found file: /var/ftp/emm/AnnivBonus_from_20080607_to_20080707_at_20080708_060001.txt
2008:07:08 07:02:51.316 (tid 1) INFO line [ msisdn = 133762, bonus = 56284, total usage = 562842 ]
2008:07:08 07:02:51.323 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.323 (tid 1) INFO line [ msisdn = 295361, bonus = 12315, total usage = 123153 ]
2008:07:08 07:02:51.324 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.324 (tid 1) INFO line [ msisdn = 130174, bonus = 16147, total usage = 161471 ]
2008:07:08 07:02:51.324 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.324 (tid 1) INFO line [ msisdn = 804610, bonus = 16287, total usage = 162873 ]
2008:07:08 07:02:51.324 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.324 (tid 1) INFO line [ msisdn = 781860, bonus = 26363, total usage = 263636 ]
2008:07:08 07:02:51.324 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.325 (tid 1) INFO line [ msisdn = 459960, bonus = 12342, total usage = 123426 ]
2008:07:08 07:02:51.325 (tid 1) INFO Recorded bonus
2008:07:08 07:02:51.325 (tid 1) INFO line [ msisdn = 910676, bonus = 17475, total usage = 174758 ]

Now the same file contains the following records

Code:
2008:07:08 07:03:20.655 (tid 4) INFO AIR credit operation success [ msisdn = 773210]
2008:07:08 07:03:20.656 (tid 4) INFO Bonus required [ msisdn = 113220, bonus = 18960, total usage = 189606 ]
2008:07:08 07:03:20.687 (tid 4) INFO AIR credit operation success [ msisdn = 113220]
2008:07:08 07:03:20.688 (tid 4) INFO Bonus required [ msisdn = 334050, bonus = 14184, total usage = 141849 ]
2008:07:08 07:03:20.719 (tid 4) INFO AIR credit operation success [ msisdn = 334050]
2008:07:08 07:03:20.720 (tid 4) INFO Bonus required [ msisdn = 893241, bonus = 64106, total usage = 641063 ]
2008:07:08 07:03:20.750 (tid 4) INFO AIR credit operation success [ msisdn = 893241]
2008:07:08 07:03:20.751 (tid 4) INFO Bonus required [ msisdn = 922615, bonus = 15175, total usage = 151756 ]
2008:07:08 07:03:20.781 (tid 4) INFO AIR credit operation success [ msisdn = 922615]
2008:07:08 07:03:20.782 (tid 4) INFO Bonus required [ msisdn = 150242, bonus = 14307, total usage = 143074 ]
2008:07:08 07:03:20.812 (tid 4) INFO AIR credit operation success [ msisdn = 150242]
2008:07:08 07:03:20.812 (tid 4) INFO Bonus required [ msisdn = 326001, bonus = 10709, total usage = 107092 ]
2008:07:08 07:03:20.842 (tid 4) INFO AIR credit operation success [ msisdn = 326001]
2008:07:08 07:03:20.842 (tid 4) INFO Bonus required [ msisdn = 132403, bonus = 18708, total usage = 187086 ]
2008:07:08 07:03:20.872 (tid 4) INFO AIR credit operation success [ msisdn = 132403]
2008:07:08 07:03:20.872 (tid 4) INFO Bonus required [ msisdn = 917950, bonus = 19989, total usage = 199896 ]

Now I want to get all the msisdns values (after = sign) from two different statements
INFO line [ msisdn = 130174, bonus = 16147, total usage = 161471 ]
INFO AIR credit operation success [ msisdn = 130174]

compare them, in case they are equal i want to output them like displayed below

Code:
20080708, 130174, 16147
.
.
.

The values that are not found in both sets of data can be output in an error file

Guys i need help to create this logix in UNIX/Solaris machine. So far i am unable to use the scripting knowledge that i have to perform this function.



Regards,
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help required on building the logic

Hi, Can anyone please help me on building the logic for writing a shell script which can delete blank lines from a file and count the number of duplicate lines in a file. Thanks, Indra (2 Replies)
Discussion started by: igandu
2 Replies

2. Shell Programming and Scripting

Need help in building Unix script

Hi all, We have a requirement like we need to create a program which will change a particular string in the file. For example +=KA1238767 1121 3344645 686943 22356 01 567893 12435 12121 983627 121 1092 091217 02 may be for engine failure In the above file we need to change the bold string... (2 Replies)
Discussion started by: susant.igate
2 Replies
All times are GMT -4. The time now is 01:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy