shell script + match MAJOR and CRITICAL strings from log file
I need to match lines that have MAJOR and CRITICAL strings
that comes after the word ERROR:< any integer number >
please advice how to do that with one awk or sed command?
more HW_Log.txt CHK_HW ERROR:0 INFO self_monitor Verifying HW machine
CHK_HW ERROR:1 MAJOR self_monitor Verifying HW machine
CHK_HW ERROR:1 CRITICAL self_monitor Verifying HW machine
This can be done using grep like:
$ grep "ERROR:[0-9]* (CRITICAL|MAJOR)" /path/to/file
Check more discussion of this question.
Related posts:
- How to fetch lines between two strings using shell script?
- Shell script to extract string from a file and return the next chars until a whitespace
- Shell Script: How do I turn “virsh list | grep MediaWiki” into an if condition?
- Shell Script for Sending output or log via email
- Shell script file name format
Leave a comment
Recent Posts
- Is there a way for administrators to disable users from installing Firefox extensions?
- Is there research material on NTP accuracy available?
- How to create a limited “domain admin” that does not have access to domain controllers?
- Can Windows RDC admin users be immune from being kicked?
- Domain Administrators account policy (After PCI audit)
Tags
active-directory
amazon-ec2
apache
apache2
backup
bash
centos
cisco
command-line
debian
dns
email
exchange
firewall
iis
iis7
iptables
linux
macosx
monitoring
mysql
networking
nginx
performance
permissions
php
postfix
raid
security
sql-server
sql-server-2005
sql-server-2008
ssh
ssl
ubuntu
unix
virtualization
vpn
webserver
windows
windows-7
windows-server-2003
windows-server-2008
windows-server-2008-r2
windows-xp





