Solved

access shell variables in egrep

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Backup Raspberri Pi over the netowrk to a Windows Share 5 52
000webhost.com default error log 1 39
bash file 10 49
AWK use math to add new field - single file 5 36
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
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 several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

809 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