The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-17-2008
thepurple thepurple is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 134
Perl or awk/egrep from big files??

Hi experts.

In one thread i have asked you how to grep the string from the below sample file-

Unfortunately the script did not gave proper output (it missed many strings). It happened may be i did gave you the proper contents of the file

That was the script-
"$ perl -00nle'print join "\n", /<fullOperation>(.*?):.*<fullResult>(.*?);/s' filename.txt"

Now for you convinience i paste contents here from the begining of the file-

Output of the below file would be-

CREATE
RESP:-3010

DELETE
RESP:0

CREATE
RESP:911364896

GET
RESP:0

SET
RESP:911265678


<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190811100759420954">
<category>Upstream.CAI</category>
<operation>Login</operation>
<target>CAI</target>
<instance></instance>
<user></user>
<context></context>
<fullOperation>LOGIN:server1:eri4ema</fullOperation>
<starttime>20081110075942.366900</starttime>
<stoptime>20081110075942.424451</stoptime>
<fullResult>RESP:3001;</fullResult>
<status>FAILED</status>
</log>
<log logid="83efeae5190811100759480955">
<category>Upstream.CAI</category>
<operation>Login</operation>
<target>CAI</target>
<instance></instance>
<user></user>
<context></context>
<fullOperation>LOGIN:server1:eri4ema;</fullOperation>
<starttime>20081110075948.375669</starttime>
<stoptime>20081110075948.375923</stoptime>
<fullResult>RESP:3007;</fullResult>
<status>FAILED</status>
</log>
<log logid="83efeae5190811100759580956">
<category>Upstream.CAI</category>
<operation>Login</operation>
<target>CAI</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>LOGIN:server1:*******;</fullOperation>
<starttime>20081110075958.354986</starttime>
<stoptime>20081110075958.355238</stoptime>
<fullResult>RESP:0;</fullResult>
<status>SUCCESSFUL</status>
</log>
</LogItems>

<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190811100802020957">
<category>Upstream.CAI</category>
<operation>Get</operation>
<target>ESUB</target>
<instance>CODE=432350114484630</instance>
<user>server1</user>
<context>sog</context>
<fullOperation>GET:ESUB:CODE,432350114484630;</fullOperation>
<starttime>20081110080202.185236</starttime>
<stoptime>20081110080202.834500</stoptime>
<fullResult>RESP:11000003;UNKNOWN SUBSCRIBER;</fullResult>
<status>FAILED</status>
</log>
</LogItems>

<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190811100802120958">
<category>Upstream.CAI</category>
<operation>Get</operation>
<target>DSUB</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>GETSUB:MDN,989352375449;</fullOperation>
<starttime>20081110080212.352053</starttime>
<stoptime>20081110080213.376720</stoptime>
<fullResult>RESP:0:MDN,989352375449:CODE,432350114484630:COUNTRY,FI:LANG,fi:PRE,0:SUBNAME,Eserve:MMS ,1;</fullResult>
<status>SUCCESSFUL</status>
</log>
</LogItems>

<?xml version='1.0' encoding='ISO-8859-1' standalone='no'?>
<LogItems>
<log logid="83efeae5190811100802350959">
<category>Upstream.CAI</category>
<operation>Get</operation>
<target>ACCOUNTINFORMATION</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>GET:ACCOUNTINFORMATION:SubscriberNumber,989352375449;</fullOperation>
<starttime>20081110080235.264165</starttime>
<stoptime>20081110080235.555880</stoptime>
<fullResult>RESP:-3010;;</fullResult>
<status>FAILED</status>
</log>
<log logid="83efeae5190811100802450960">
<category>Upstream.CAI</category>
<operation>Delete</operation>
<target>EDSUB</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>DELETE:EDSUB:CODE,432350114484630:MDN,989352375449:PRE,0EST,ALL;</fullOperation>
<starttime>20081110080245.012208</starttime>
<stoptime>20081110080245.857994</stoptime>
<fullResult>RESP:0;</fullResult>
<status>SUCCESSFUL</status>
</log>
<log logid="83efeae5190811100802510961">
<category>Upstream.CAI</category>
<operation>Create</operation>
<target>EDSUB</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>CREATE:EDSUB:CODE,432350114484630:KI,1C9B39AAF3931D60C064F6E8FBB5B1E6:MDN,98935237544 9:PRE,0EST,ALL;</fullOperation>
<starttime>20081110080251.089898</starttime>
<stoptime>20081110080251.489396</stoptime>
<fullResult>RESP:911364896;</fullResult>
<status>FAILED</status>
</log>
<log logid="83efeae5190811100802540962">
<category>Upstream.CAI</category>
<operation>Get</operation>
<target>ESUB</target>
<instance>CODE=432350114484630</instance>
<user>server1</user>
<context>sog</context>
<fullOperation>GET:ESUB:CODE,432350114484630;</fullOperation>
<starttime>20081110080254.000313</starttime>
<stoptime>20081110080254.697545</stoptime>
<fullResult>RESP:0:MDN,989352375449:CODE,432350114484630:T11,1:T21,1:T22,1:B16,1:T62,1:BAIC,0:BAOC,0 :BOIC,0:BIRO,0:BORO,0:BOIH,0:BOS4,0:CLIP,1:CLIR,0:CFB,1:CFNR,1:CFNA,1:CFU,1:HOLD,1:CW,1:MPTY,1:BAICS ,0,0:BAOCS,0,0:BOICS,0,0:PRE,0;</fullResult>
<status>SUCCESSFUL</status>
</log>
<log logid="83efeae5190811100802570963">
<category>Upstream.CAI</category>
<operation>Set</operation>
<target>DSUB</target>
<instance></instance>
<user>server1</user>
<context>sog</context>
<fullOperation>SETSUB:MDN,989352375449;</fullOperation>
<starttime>20081110080257.888204</starttime>
<stoptime>20081110080257.999121</stoptime>
<fullResult>RESP:911265678;</fullResult>
<status>FAILED</status>
</log>
</LogItems>