HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: PERL scripting - help
Operating System - Linux
1828349
Members
3054
Online
109976
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 05:29 AM
11-02-2005 05:29 AM
PERL scripting - help
Hi,
Please find attached a log file which is my input file.
I need to extract the portion of the log which is for the last 2 hours and parse that to generate the output which looks like this:
Hostname Error Code time range
The error code is the 4th field in the input. It is successful if the code is "000" and failure otherwise.
I just need all the error codes for the last 2 hours for the day in my output.
Hostname should be the name of the server.
Can anyone please help me to write the script using PERL.
Thanks,
Rahul
Please find attached a log file which is my input file.
I need to extract the portion of the log which is for the last 2 hours and parse that to generate the output which looks like this:
Hostname Error Code time range
The error code is the 4th field in the input. It is successful if the code is "000" and failure otherwise.
I just need all the error codes for the last 2 hours for the day in my output.
Hostname should be the name of the server.
Can anyone please help me to write the script using PERL.
Thanks,
Rahul
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 05:41 AM
11-02-2005 05:41 AM
Re: PERL scripting - help
1) I don't see you hostname.
2) I could certainly write this but I will not when someone is too lazy to even make the attempt.
2) I could certainly write this but I will not when someone is too lazy to even make the attempt.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2005 05:53 AM
11-02-2005 05:53 AM
Re: PERL scripting - help
Hi Rahul:
I'm not sure what your fields really are. Assuming that the time period begins in the second (zero-relative) character of the second (zero-relative) field, something like this would output non-zero (e.g. "35V") results for hours greater than "9":
perl -lanF";" -e 'print $F[3] if substr($F[1],2,2) > 9 && $F[3] !~/000/' logfile
Regards!
...JRF...
I'm not sure what your fields really are. Assuming that the time period begins in the second (zero-relative) character of the second (zero-relative) field, something like this would output non-zero (e.g. "35V") results for hours greater than "9":
perl -lanF";" -e 'print $F[3] if substr($F[1],2,2) > 9 && $F[3] !~/000/' logfile
Regards!
...JRF...
- Tags:
- Perl
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP