SPUG: Where is grep's return value?

Orr, Chuck (NOC) chuck.orr at attws.com
Tue Sep 10 17:27:32 CDT 2002


I have something that looks like this:

if (grep("$KEY",EXISTING)){

In the event that this is true, I want to print the data that makes it true.
In other words, I want to print the line from EXISTING that contains the
pattern from the variable $KEY.  The problem I am having is figuring out
where that line is.  Is it stored in a variable I don't know about?  If not,
how can I obtain this data?  I realize this is a pretty basic question, but
I am having a tough time finding the answer and I need to get this done.
Any suggestions/help would be greatly appreciated.

Chuck Orr

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list