GREP in Bourne


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting GREP in Bourne
# 1  
Old 05-12-2008
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.
# 2  
Old 05-12-2008
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.
# 3  
Old 05-12-2008
u can use the option -w with grep, this will match the exact string which you want to search.
# 4  
Old 05-12-2008
thanks

thanks for the advices. I'll try it now
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bourne/C shell help

Exercise Five Write a Bourne shell script which: • Professionalism: plan for this from the start. • Has one command line argument. • If the command line argument is a directory then the script should output the number of files in the directory. • If the command line argument is an ordinary... (2 Replies)
Discussion started by: moesom
2 Replies

2. Shell Programming and Scripting

help with bourne script

Hey guys not sure why but when i execute the script i get the correct result but then it says command not found not sure why can anyone see anything wrong with my code below? I just want to print how much quota i have used in my home directory #!bin/sh `quota -v | grep ^/home | awk... (2 Replies)
Discussion started by: musicmancanora4
2 Replies

3. Shell Programming and Scripting

Bourne and decimals??

I need to get 15% of the variable exer1 to be added to other exercises so far, i've got exer1=$1 aver=`expr $exer \* .15` but i keep getting an error that an integer value was expected. Is there anyway around this? (1 Reply)
Discussion started by: kdyzsa
1 Replies

4. Shell Programming and Scripting

Bourne Script help

Hey guys, I am trying to do a bourne script to look for c files in the current directory. I had it working where it finds the files and asks you to delete them or not, which works, but if there i no files, then it comes up with errors, which iam trying to get rid of. So I thought I would do a if... (2 Replies)
Discussion started by: Pits
2 Replies

5. UNIX for Dummies Questions & Answers

Bourne-again shell

Hi guys !! well i'm still new in learning UNIX , and actually i'm still studying it by myself .. anyway, some people told me the Bourne-again shell is a good version of UNIX to work on , and i tried to download yesterday but i didn't know how to start it ...... the ReadMe file associated with... (3 Replies)
Discussion started by: mrsamer
3 Replies

6. Shell Programming and Scripting

bourne script help

I need to make a small script that figures out if a filename that the user enters is a file or a directory. and if it is a directory, how many files are in it. please point me to the right direction, I am a newbie at this. (1 Reply)
Discussion started by: Heedunk
1 Replies

7. Shell Programming and Scripting

simple Bourne problem

Hi, I'm a newer for this languages, and I have a log file, which is something like this: 35.75.253.207 - - "GET /products/orgonizer/title.png HTTP/1.1" 200 1555 "-" "Mozilla 1.4" Now, I want to write a shell code to accoplish like ./XXX.sh -N n n is a number by user input, the code should... (5 Replies)
Discussion started by: pnxi
5 Replies

8. Shell Programming and Scripting

simple bourne script

Hello There, I am trying to write this SIMPLE script in Bourne Shell but I keep on getting a blank response. Can you see what I am doing wrong? I am simply trying to take the day of the week from our system and when the teachers sign on I want them to see the message of the day, when they exe... (2 Replies)
Discussion started by: catbad
2 Replies

9. UNIX for Dummies Questions & Answers

bourne if, then, else

Hello, A quick, probably dumb question. I'm working on a program and i need to loop through several options. i'm currently doing a bunch of if then else's. i was wondering 2 things in unix (bourne) can i stack else's. 2 would i be better off just using case ie read line if then ... (2 Replies)
Discussion started by: Priest_Ridden
2 Replies

10. Shell Programming and Scripting

bourne shell script

Hi all, Can somebody answer the following query Thanks, Srinivas A shell program that takes one or any number of file directory names as input; sorts the directories given as parameters jointly in the ascending or decending order of choice For EX : dips abc etc desc will sort the files... (2 Replies)
Discussion started by: psrinivas
2 Replies
Login or Register to Ask a Question