Looking for a linux command line solution

This is child-like I am sure, as all things are once you know the answer.  I have never needed to do much on the command line besides the usual.  I am curious if there is a way to do this simple task without writing an actual script...

I do this:

grep 'BOOTPROTO' /etc/sysconfig/network/ifcfg-eth0

Open in new window


I get this:

BOOTPROTO='static'

Open in new window


I need this:

static

Open in new window


I thought awk would be easy, but the lack of spaces in the result shut that idea down.  I have no idea how to trim this out via command line.  Maybe there is a command to return only that between the single quotes or some such.  Maybe a regular expression?  Not my area.  Hoping this can be my 'one new thing' for today...

O
Owen_ParkerAsked:
Who is Participating?
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.

Dave GouldOnsite SupportCommented:
grep 'BOOTPROTO' /etc/sysconfig/network/ifcfg-eth0 | awk -F= '{print $2}' will give you

'static' but leave the single quotes

However, you could try

grep 'BOOTPROTO' /etc/sysconfig/network/ifcfg-eth0 |awk -F\' '{print $2}'

-F = use the following as a field separator. The \ is to escape the single quote so that it is not interpreted as a special char.
0

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
Owen_ParkerAuthor Commented:
Splendid  trappa01!  The explanation is much more valuable than the answer!  I have never used awk per se, but have seen it used many times by my resident engineer/Linux guru I usually push this stuff to.  I'll review better the options now that i know better the possibilities.
0
Owen_ParkerAuthor Commented:
Perfectly explained final answer...
0
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.