Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access shell variables in egrep

Posted on 2008-10-07
2
Medium Priority
?
936 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 500 total points
ID: 22660136
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
ID: 31503874
doh!  it was a rogue space causing the issues.. thanks
0

Featured Post

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month10 days, 13 hours left to enroll

885 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