![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with GREP. | syndex | Shell Programming and Scripting | 2 | 07-11-2007 02:44 PM |
| grep problem | asal_email2 | UNIX for Dummies Questions & Answers | 4 | 06-22-2005 09:49 PM |
| grep problem | svennie | UNIX for Dummies Questions & Answers | 5 | 11-08-2004 04:29 AM |
| Grep Problem | lesstjm | Shell Programming and Scripting | 2 | 10-27-2004 11:13 AM |
| Grep problem | odogbolu98 | Shell Programming and Scripting | 3 | 02-18-2003 03:53 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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 10:15 AM.. Reason: added code tags |
|
||||
|
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 10:15 AM.. Reason: added code tags |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|