![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cat and grep not working | jphess | UNIX for Advanced & Expert Users | 3 | 09-08-2008 01:51 PM |
| grep -r isn't working | harishmitty | SUN Solaris | 8 | 09-03-2008 11:44 PM |
| Grep not working - special characters?? | gugs | Shell Programming and Scripting | 3 | 07-31-2008 08:22 AM |
| grep -A switch not working correctly with -m | zer0 | UNIX for Dummies Questions & Answers | 2 | 06-19-2008 03:26 AM |
| grep is not working, please find out the problem | kittusri9 | Shell Programming and Scripting | 3 | 05-07-2008 07:32 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
grep not working
This condition is not able to grep , can any one tell what's wrong with this part.
I am able to see from unix command but not with host script. Code:
echo "Checking for Loader Status " >> $REPFILE
if test $? = 0
then
echo "Successful termination of SQL*Loader "$LOADER1 >> $REPFILE
grep "successfully loaded." $LOGDIR/$LOADER1.log >> $REPFILE
grep "not loaded due to data errors" $LOGDIR/$LOADER1.log >> $REPFILE
grep "not loaded because all fields were null" $LOGDIR/$LOADER1.log >> $REPFILE
else
echo "Loader has some problems " >> $REPFILE
PROBLEMS=1
fi
|
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
its because its getting failed in
Quote:
Quote:
Quote:
|
|
#3
|
|||
|
|||
|
No luck..
I am trying to called sqlloader from unix. SQLlaoder execution went fine, but could not able to grep. Is some problem with unix version. Same code works fine in solaries, this time working in HP-UX |
|
#4
|
|||
|
|||
|
No, the if is correct. If you use test instead of [ you don't need the closing square bracket. Single equals signs are permitted (and I believe more portable than double equals signs).
It's not clear from which command you want the exit code in $? -- from the echo, or from some previous command? The way I read it you will always have the exit code from the echo, which will always be zero; is that not what you are seeing? In what way are the greps failing -- not running, or not returning what you expect? Do you get an error message? |
|
#5
|
||||
|
||||
|
Quote:
|
|
#6
|
|||
|
|||
|
$? applies to the last command executed. In this case an "echo" rather than the main command.
You'll need to save the exit status from the main command immediately after execution. sqlcommand_we_want_to_check ; ERROR=$? . # Other commands . if [ ${ERROR} = 0 ] ... etc. |
|||
| Google The UNIX and Linux Forums |