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
Bourne and decimals?? kdyzsa Shell Programming and Scripting 1 05-06-2008 07:54 PM
Bourne Script help Pits Shell Programming and Scripting 2 09-05-2007 11:15 PM
Bourne-again shell mrsamer UNIX for Dummies Questions & Answers 3 09-29-2006 11:42 PM
bourne script help Heedunk Shell Programming and Scripting 1 02-05-2004 04:49 PM
bourne if, then, else Priest_Ridden UNIX for Dummies Questions & Answers 2 12-12-2001 07:18 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: May 2008
Posts: 14
Stumble this Post!
GREP in Bourne

I have a problem.

Suppose I have a log transport.log with the ff:
>>
tp finished with return code: 203
meaning:
wrong syntax in tp call
<<

I'm working on creating a script to find out if there are error are not. Unfortunately, the only way to check if there is error is if the return code is 0. I've tried to grep it with 'grep 0 transport.log` but it also return the one with 203. I just need to know if the return code is 0. not 10, no 90, not 103, but 0, and since grep searches for patterns it always returns even if the code is 10, 470. Anyway around this? I need to get the line if the return code is 0.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: Apr 2008
Location: Bangalore
Posts: 120
Stumble this Post!
Hi,

for solving the problem , u can grep on return code: 0 instead of 0.

on HP machine, u can use -x option. when u use x oprion, it will match only distinct words and not substrings.

Can somebsoy suggest me whats the equivalent on solaris and aix.
Reply With Quote
  #3 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: Aug 2007
Location: Bangalore
Posts: 285
Stumble this Post!
u can use the option -w with grep, this will match the exact string which you want to search.
Reply With Quote
  #4 (permalink)  
Old 05-12-2008
Registered User
 

Join Date: May 2008
Posts: 14
Stumble this Post!
thanks

thanks for the advices. I'll try it now
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:14 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