need help grep'g

wow this is embarrasing

i have an sql file that is monsterous.

i need to getout all the sql statements that have 'ssmith' , This includes those surrounding single qoutes. there are many smiths and words with smith in them.

I tried

grep ''ssmith'' dump.sql (thats two single qoutes)
grep "'ssmith'" dump.sql
grep "\'ssmith\'" dump.sql (finds nothing)

they all still find stuff like melissasimmonssmith

please help
pariesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Heem14Commented:
try

grep -w ssmith dump.sql

maybe grep -iw if you need case insensitivity
sda100Commented:
Hi paries

grep -w "'ssmith'" dump.sql

... is the one you need (double-quotes surrounding single-quotes).  The -w is to match at word boundaries.

Steve :)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sda100Commented:
Heem14, you beat me by one minute!
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Heem14Commented:
:)

you don't even need the quotes - because the single quote is considered a word breaker.
pjedmondCommented:
Another approach is to:

cat dump.sql | grep -e "[ ']ssmith[ ']" > output.txt

Using > to send to the output file,
or >> to append to the output file.

The above statment breaks down your requirement really easily. First cat the file concerned ,then get lines that have either a space or ' followed by ssmith and then followed by either a space or '. Obviously you can:

grep -e "[ ']ssmith[ ']" dump.sql

But looking at the structure of the above command it is easier to understand and manage, without having to resort to:

man grep

Also the above structure is more versatile for other scenarios that you might encounter.

HTH:)
Heem14Commented:
thanks, I appreciate the points.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.