Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Parse file to count specific records??

Posted on 2006-11-04
2
Medium Priority
?
368 Views
Last Modified: 2009-12-16
In the file below I need to count how many records there are with the text: "MAXRUNALARM" or "JOBFAILURE" in the record. The pipe symbol is ithe record delimiter.

In this case there is a total of 13 records that meet the critieria.

sqlserv@ho|hol0127@isard|Fri Nov  3 02:14:20 2006|MAXRUNALARM|sqlservDBCpyRestoreDBVFNT
sqlserv@ho|hol0127@isard|Fri Nov  3 02:30:39 2006|CHASE|sqlservDBCpyRestoreDBVFNT
sqlserv@ho|hol0127@isard|Fri Nov  3 03:00:39 2006|CHASE|sqlservDBCpyRestoreDBVFNT
sqlserv@ho|ben1962@isard|Thu Nov  2 23:44:45 2006|MAXRUNALARM|sqlservEPHoldRestoreDBNT
stormgmt|tra3905@isard|Thu Nov  2 13:48:50 2006|JOBFAILURE|stormgmtCTMOperMartBkpBox
root|ben1962@isard|Fri Nov  3 06:15:19 2006|MAXRUNALARM|stormgmtNBUCancelNB
stormgmt|tra3905@isard|Thu Nov  2 13:52:04 2006|JOBFAILURE|stormgmtNBUInfoBox
udb|tra3905@isard|Thu Nov  2 13:49:04 2006|JOBFAILURE|stormgmtudbOnlineEbisdwpBkp1
udb|hol0127@isard|Fri Nov  3 01:48:23 2006|JOBFAILURE|stormgmtudbOnlineIpsamddpBkp
udb||Fri Nov  3 06:48:23 2006|MAXRUNALARM|stormgmtudbOnlineIpsconspBkp
udb|tra3905@isard|Thu Nov  2 13:18:58 2006|MAXRUNALARM|udbAuthCheckDanu04
udb|tra3905@isard|Thu Nov  2 13:15:51 2006|MAXRUNALARM|udbHeartbeatKubaz01
udb|tra3905@isard|Thu Nov  2 13:15:35 2006|MAXRUNALARM|udbHeartbeatTechno02
udb|str0264@isard|Thu Nov  2 12:53:48 2006|JOBFAILURE|udbHostInfoBox
udb|kel4693@yowza|Thu Nov  2 14:46:29 2006|MAXRUNALARM|udbHostInfoBox
udb|str0264@isard|Thu Nov  2 12:53:41 2006|STARTJOBFAIL|udbHostInfoBultar02
udb|str0264@isard|Thu Nov  2 12:53:42 2006|MAX_RETRYS|udbHostInfoBultar02

Thanks
0
Comment
Question by:Richard Kreidl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
tone28 earned 2000 total points
ID: 17873055
passing the file as an argument you can do this

while(<>) {
        $count++ if /(MAXRUNALARM|JOBFAILURE)/;
}

print $count;
0
 
LVL 2

Author Comment

by:Richard Kreidl
ID: 17873167
Thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question