The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing global variable to a function which is called by another function sars Shell Programming and Scripting 4 06-30-2008 08:39 AM
egrep help Darklight Shell Programming and Scripting 1 04-17-2008 11:34 PM
egrep DNAx86 Shell Programming and Scripting 7 01-18-2008 04:59 AM
Egrep cheat sheet anywhere? Looking for meaning of egrep -c leelm UNIX for Dummies Questions & Answers 2 01-11-2008 11:37 AM
help with egrep akDBA UNIX for Dummies Questions & Answers 9 08-02-2006 02:33 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-19-2005
Registered User
 

Join Date: Sep 2005
Posts: 9
Question egrep function ???

I have exported
LOGAME=/TESTXXX
O_M=/dev/vgibbs/lvxxx

I am trying to egrep the same along with bdf as

bdf |-egrep -w '$LOGNAME|${O_M}' *** ( I want to grep both pattern with variable )

However the same is giving "egrep: $ anchor not at end of pattern."

The above output works if I give bdf |-egrep -w 'TESTXXX|/dev/vgibbs/lvxxx'

I want the above funtionality *** to be called in script, but the same is not giving the desired output .
I am working on HP-UX system and using ksh shell.

I am on to this for long and I am stuck with this. I am waiting for your assistance so as to proceed with creation of my script. This to be made live
by tomorrow.

Thanks and Regds
Kamlesh.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-19-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Change the single quotes to double quotes - these are preventing the variable expansion.

Cheers
ZB
Reply With Quote
  #3 (permalink)  
Old 10-19-2005
Registered User
 

Join Date: Sep 2005
Posts: 9
I have already tried that. It's not working. When I call the same in scripts it gives output as :-
+ egrep -w /dev/vgibbsmig/lvxxx|
+ bdf
egrep: Unknown err.

The script is as follows:-
check_org()
{
bdf |egrep -w "${O_FS}|${O_M}"
if [ $? -eq 0 ]
then
echo "Original file system mounted "
else
echo "Original NOT MOUNTED"
exit 1
fi
}

Last edited by kamlesh_p; 10-19-2005 at 06:36 AM.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0