About
Pricing
Community
Teams
Start Free Trial
Log in
BILL Carlisle
asked on
12/10/2014
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 Scripting
Linux
Unix OS
2
1
Last Comment
BILL Carlisle
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
woolmilkporc
12/10/2014
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
12/13/2014
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
RETVAL=$(egrep -c 'PLS|ORA|ERR' $my_file)
works great!