Solved

access shell variables in egrep

Posted on 2008-10-07
2
916 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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…
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.:

911 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

25 Experts available now in Live!

Get 1:1 Help Now