Solved

How can a condition in a script look for "case sensitive" words ?

Posted on 2011-02-14
3
369 Views
Last Modified: 2013-11-17
I have this condition in order to send me a log if it encounters any of this word.  The thing is I need this "case sensitive', because the log has a filename with the word "Rejected" in it and send me the log as it where an error.

PARAM1=$(egrep -i -c "ORA-|rejected|Killed|skipped|EXP-" "$log")
0
Comment
Question by:LindaC
[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
3 Comments
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 350 total points
ID: 34889513

i think you need to remove option -i from command

PARAM1=$(egrep -c "ORA-|rejected|Killed|skipped|EXP-" "$log")
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 150 total points
ID: 34894799
Yes,

the "-i" flag means "Ignore the case (uppercase or lowercase) of letters when making comparisons", so it should obviously not be used here.

But moreover, egrep supports some kind of regular expressions, so assuming you were searching for "Killed" or "killed" or "rejected" but not "Rejected" you could do:

egrep -c "ORA-|rejected|[kK]illed|skipped|EXP-" "$log"

or assuming you were searching for "ORA-" messages whose numbers start with 1, 2, 3 or 9 you could do:

egrep -c "ORA-[1-3,9]|rejected|[kK]illed|skipped|EXP-" "$log"

A last example: Search for "dropped" or "skipped":

egrep -c "ORA-[1-3,9]|rejected|[kK]illed|(dro|ski)pped|EXP-" "$log"

Have fun!

wmp




0
 
LVL 8

Author Closing Comment

by:LindaC
ID: 34895935
Thank you so much !
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

691 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