12-05-2008
Shell script to parsing log
Hi I Have log like this :
0 234: [APPLICATION 1] {
3 2: [sequenceNumber] 04 EE
7 14: [timeStamp] '20081114081'
23 1: [trigger] 00
79 10: [msisdn] '38809'
91 15: [imsi] '528111510010159'
143 29: [applicationDescription] 'Streaming/downloading service'
174 3: [custom0] 'MTV'
179 43: [contentUrl] 'rtsp://172.28/MTV2GO-Loop.sdp'
224 1: [contentRate] 05
227 1: [priceType] 01
230 2: [currencyCode] 39 36
234 1: [currencyExponent] FE
: }
237 248: [APPLICATION 1] {
240 2: [sequenceNumber] 04 EF
244 14: [timeStamp] '20081114082116'
260 1: [trigger] 02
316 10: [msisdn] '38809'
328 15: [imsi] '528111510010'
360 1: [paymentMethod] 01
380 29: [applicationDescription] 'Streaming/downloading service'
411 3: [custom0] 'MTV'
416 43: [contentUrl] 'rtsp://172.28/MTV2GO-Loop.sdp'
461 3: [transferredVolume] 19 83 87
466 1: [timeDuration] 5D
469 1: [debitedCost] 08
472 1: [chargingStatus] 01
475 1: [contentRate] 05
478 1: [priceType] 01
481 2: [currencyCode] 39 36
485 1: [currencyExponent] FE
: }
712 236: [APPLICATION 1] {
715 2: [sequenceNumber] 04 F1
719 14: [timeStamp] '20081114082'
735 1: [trigger] 01
791 10: [msisdn] '38997'
803 15: [imsi] '528111500081770'
820 10: [ipAddress] '10.84.8.66'
832 1: [clientProtocol] 01
835 1: [paymentMethod] 01
855 29: [applicationDescription] 'Streaming/downloading service'
886 35: [contentUrl] 'rtsp://172.28/cnn.sdp'
923 3: [transferredVolume] 26 D0 CD
928 2: [timeDuration] 00 A9
932 1: [debitedCost] 0E
935 1: [chargingStatus] 01
938 1: [contentRate] 05
941 1: [priceType] 01
944 2: [currencyCode] 39 36
948 1: [currencyExponent] FE
: }
.....
.....
I Want that log become just only "[trigger] 02"
and then collect into Timestamp,msisdn,timeduration,contentUrl
anybody can help me ??
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
how to parse the command line argument to look for '@' sign and the following with '.'.
In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format.
rmjoe123@hotmail.com has '@' sign and followed by a '.'
to be more... (1 Reply)
Discussion started by: rmjoe
1 Replies
2. Shell Programming and Scripting
Hi,
I have a requirement. I have an application which can take a file as inputs. Now the file can contain any number of lines. The tool has to pick up the first uncommented line and begin processing it.
For example the file could be like this:
#MANI123|MANI1234
#MANI234|MANI247... (4 Replies)
Discussion started by: sendhilmani123
4 Replies
3. Shell Programming and Scripting
am relatively new to Shell scripting.
I have written a script for parsing a big file. The logic is:
Apart from lot of other useless stuffs, there are many occurances of <abc> and corresponding </abc> tags. (All of them are properly closed)
My requirement is to find a particular tag (say... (3 Replies)
Discussion started by: gurpreet470
3 Replies
4. Shell Programming and Scripting
I have record line somthing like below with first line showing char spacing not real record line
1 | 2 | 3rd Field--------------|-4th field--| This is charcatersapcing of line
DF20000000000000000130.7890000000750
I shoudl get two line from above line
1st line should
1 | 2 | 3rd... (3 Replies)
Discussion started by: unishiva
3 Replies
5. UNIX for Dummies Questions & Answers
#I'm quite new to scripting and my boss has asked me to solve a simple problem and sadly, I can't figure out how to do it. Any help is appreciated.
:confused:
#The following is a small shell script and the output that it produces for google.com.
#!/bin/sh
whois $1 | grep "Name Server"... (5 Replies)
Discussion started by: jjamd64
5 Replies
6. Shell Programming and Scripting
Hello,
I am an absolute newbie and whatever I've written in the shell script (below) has all been built with generous help from googling the net and this forum. Please forgive any schoolboy mistakes.
Now to the qn, my input file looks like this -
2009:04:03 08:21:41:513,INFO... (7 Replies)
Discussion started by: sowmitr
7 Replies
7. Shell Programming and Scripting
Hello,
I'm a starting shell scripter and no Perl knowledge. I've trying to do this for a while:
I want to parse an XML file and get certain data out of it and write that data into a CSV file, all this using Shell Scripting (in Bash). Or Perl without any XML Parser/Interpreter (if possible).
... (1 Reply)
Discussion started by: Kage Musha
1 Replies
8. Shell Programming and Scripting
Below is a XML I have...
<?xml version="1.0" encoding="UTF-8" ?>
<component
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:XXXXX-www-Install-Manifest manifest.xsd"
xmlns="urn:qqqqq-Install-Manifest"
name="OM"
... (1 Reply)
Discussion started by: dashok.83
1 Replies
9. Shell Programming and Scripting
I have a xml file like this
<bul:collectionStrategy name="strategy1">
<bul:collectionTemplateGroup name="15min group"/>
<bul:collectionTemplateGroup name="hourly group"/>
</bul:collectionStrategy>
<bul:CollectionTemplateGroup name="hourly group" >
... (2 Replies)
Discussion started by: LavanyaP
2 Replies
10. Shell Programming and Scripting
I have a file parameters.txt which contains
151524
151525
I have another file OID.csv which contains
NE Version Object Type ID SDK param name Object OID
test1 Start: 4.2 End: 4.2 pan 151524 speed ... (5 Replies)
Discussion started by: LavanyaP
5 Replies
LEARN ABOUT SUNOS
iconv_maz
iconv_maz(5) Standards, Environments, and Macros iconv_maz(5)
NAME
iconv_maz - code set conversion tables for Mazovia
DESCRIPTION
The following code set conversions are supported:
+--------------------------------------------------------------------+
| Code Set Conversions Supported |
+--------------+--------+--------------+--------+--------------------+
| Code |Symbol |Target Code |Symbol | Target |
+--------------+--------+--------------+--------+--------------------+
|Output | | | | |
+--------------+--------+--------------+--------+--------------------+
|Mazovia |maz |ISO 8859-2 |iso2 | ISO Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|Mazovia |maz |MS 1250 |win2 | Windows Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|Mazovia |maz |MS 852 |dos2 | MS-DOS Latin 2 |
+--------------+--------+--------------+--------+--------------------+
|Mazovia |maz |DHN |dhn | Dom Hanlowy Nauki |
+--------------+--------+--------------+--------+--------------------+
CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal.
Mazovia to ISO 8859-2
For the conversion of Mazovia to ISO 8859-2, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| Mazovia | ISO 8859-2 | Mazovia | ISO 8859-2 |
|24-177 | 40 |230 |246 |
|200 | 307 |231 |326 |
|201 | 374 |232 |334 |
|202 | 351 |233 |40 |
|203 | 342 |234 |243 |
|204 | 344 |235 |40 |
|205 | 40 |236 |266 |
|206 | 261 |237 |40 |
|207 | 347 |240 |254 |
|210 | 40 |241 |257 |
|211 | 353 |242 |363 |
|212-213 | 40 |243 |323 |
|214 | 356 |244 |361 |
|215 | 346 |245 |321 |
|216 | 304 |246 |274 |
|217 | 241 |247 |277 |
|220 | 312 |250-340 |40 |
|221 | 352 |341 |337 |
|222 | 263 |342-365 |40 |
|223 | 364 |366 |367 |
|224 | 366 |367 |40 |
|225 | 306 |370 |260 |
|226-227 | 40 |371-376 |40 |
|256 | 201 | | |
+---------------+----------------+----------------+---------------+
Mazovia to MS 1250
For the conversion of Mazovia to MS 1250, all characters not in the following table are mapped unchanged.
+---------------+----------------+----------------+---------------+
| Mazovia | MS 1250 | Mazovia | MS 1250 |
|200 | 307 |236 |234 |
|201 | 374 |237 |40 |
|202 | 351 |240 |217 |
|203 | 342 |241 |257 |
|204 | 344 |242 |363 |
|205 | 40 |243 |323 |
|206 | 271 |244 |361 |
|207 | 347 |245 |321 |
|210 | 40 |246 |237 |
|211 | 353 |247 |277 |
|212-213 | 40 |250-251 |40 |
|214 | 356 |252 |254 |
|215 | 346 |253-255 |40 |
|216 | 304 |256 |253 |
|217 | 245 |257 |273 |
|220 | 312 |260-340 |40 |
|221 | 352 |341 |337 |
|222 | 263 |342-345 |40 |
|223 | 364 |346 |265 |
|224 | 366 |347-360 |40 |
|225 | 306 |361 |261 |
|226-227 | 40 |362-365 |0 |
|230 | 214 |366 |367 |
|231 | 326 |367 |40 |
|232 | 334 |370 |260 |
|233 | 40 |371 |40 |
|234 | 243 |372 |267 |
|235 | 40 |373-376 |40 |
|274 | 212 | | |
+---------------+----------------+----------------+---------------+
Mazovia to MS 852
For the conversion of Mazovia to MS 852, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| Mazovia | MS 852 | Mazovia | MS 852 |
|205 | 40 |234 |235 |
|206 | 245 |235 |40 |
|210-213 | 40 |236 |230 |
|215 | 206 |237 |40 |
|217 | 244 |240 |215 |
|220 | 250 |241 |275 |
|221 | 251 |243 |340 |
|222 | 210 |244 |344 |
|225 | 217 |245 |343 |
|226-227 | 40 |246 |253 |
|230 | 227 |247 |276 |
|233 | 40 |250-375 |40 |
|227 | 327 | | |
+---------------+----------------+----------------+---------------+
Mazovia to DHN
For the conversion of Mazovia to DHN, all characters not in the following table are mapped unchanged.
+-----------------------------------------------------------------+
| | Conversions|Performed | |
| Mazovia | DHN | Mazovia | DHN |
|200-205 | 40 |234 |203 |
|206 | 211 |236 |217 |
|207-214 | 40 |240 |207 |
|215 | 212 |241 |210 |
|216 | 40 |242 |216 |
|217 | 200 |243 |205 |
|220 | 202 |244 |215 |
|221 | 214 |246 |220 |
|225 | 201 |247 |221 |
|230 | 206 | | |
+---------------+----------------+----------------+---------------+
FILES
/usr/lib/iconv/*.so conversion modules
/usr/lib/iconv/*.t conversion tables
/usr/lib/iconv/iconv_data list of conversions supported by conversion tables
SEE ALSO
iconv(1), iconv(3C), iconv(5)
SunOS 5.10 18 Apr 1997 iconv_maz(5)