Avatar of BILL Carlisle
BILL Carlisle
Flag for United States of America asked on

what is the syntax to get the count of 2 or more strings..

Hi,
I want to grep a file for 2 or more strings and get a count back.

for one string I have this..
RETVAL=`egrep -c '(PLS)-' ${my_file}`

what is the syntax to get the count of 2 or more strings..

if my file has any of these strings return the count
file name = "my_file"
strings="PLS" and "ORA" and "ERR"

Thx, Bill
Shell ScriptingLinuxUnix OS

Avatar of undefined
Last Comment
BILL Carlisle

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
woolmilkporc

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
BILL Carlisle

ASKER
Thank you!
RETVAL=$(egrep -c 'PLS|ORA|ERR' $my_file)
works great!
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck