Solved

access shell variables in egrep

Posted on 2008-10-07
2
913 Views
Last Modified: 2013-12-26
Hi,

I want to remove any lines in the report that have the value of $curver and store in results..

This is not working:

cat report | egrep -v $curver > results

I've googled for ages on this.. not very experienced with shell scripting.

Anyone know how this can be done?

Regards,

Kevin
0
Comment
Question by:kmcghee
2 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 125 total points
Comment Utility
try

cat report | egrep -v "$curver" > results

OR

eval cat report | egrep -v "$curver" > results

Since $curver might have spce(s) in it.
0
 
LVL 1

Author Closing Comment

by:kmcghee
Comment Utility
doh!  it was a rogue space causing the issues.. thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now