![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with GREP. | syndex | Shell Programming and Scripting | 2 | 07-11-2007 10:44 AM |
| grep problem | asal_email2 | UNIX for Dummies Questions & Answers | 4 | 06-22-2005 05:49 PM |
| grep problem | svennie | UNIX for Dummies Questions & Answers | 5 | 11-08-2004 01:29 AM |
| Grep Problem | lesstjm | Shell Programming and Scripting | 2 | 10-27-2004 07:13 AM |
| Grep problem | odogbolu98 | Shell Programming and Scripting | 3 | 02-18-2003 12:53 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
GREP problem
I have a problem. Suppose I have a log named transport.log
>> tp finished with return code: 203 meaning: wrong syntax in tp call .... tp finished with return code: 0 meaning: Everything ok. << What i want to do is to get the return code of the 1st one. So I would probably do: Code:
tempVar=`head -1 transport.log` I can't do check=`grep -w 0 $tempVar` since it returns an error How do I go around this since I need to check the return code twice in the transport.log Since there are 2 return codes. Last edited by Yogesh Sawant; 05-13-2008 at 06:15 AM. Reason: added code tags |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
how about something like this :
Code:
FIRSTRC=` grep "return code:" file | head -1 | awk -F: ' { print $2 } '`
LASTRC=` grep "return code:" file | tail -1 | awk -F: ' { print $2 } '`
Last edited by Yogesh Sawant; 05-13-2008 at 06:15 AM. Reason: added code tags |
|
#3
|
|||
|
|||
|
H
Hi, thanks for the quick reply. I'll give it a go right now
|
|||
| Google The UNIX and Linux Forums |