![]() |
|
|
|
|
|||||||
| 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 |
| Put the output of grep in a variable | big123456 | Shell Programming and Scripting | 3 | 04-23-2008 08:40 AM |
| Redirect grep output into file !!!!! | hanu_oracle | Shell Programming and Scripting | 2 | 04-10-2008 06:02 AM |
| output of grep | useless79 | Shell Programming and Scripting | 3 | 09-18-2007 02:36 AM |
| substitute the grep output | jasmeet100 | Shell Programming and Scripting | 1 | 10-11-2005 04:40 PM |
| Pausing a Grep output | mharley | Shell Programming and Scripting | 5 | 06-15-2005 01:14 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi,
I am getting different output for grep depending which directory I am in. The following is a transcript of my session, I am using egrep but have also used grep –E. The directory names have been changed for security: $pwd /dir1/dir2/dir3/dir4 $echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9] $echo $? 1 $cd .. $pwd /dir1/dir2/dir3 $echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9] 000000 $echo $? 0 $cd .. $pwd /dir1/dir2 $echo 000000 |egrep -v [0-1][0-9][0-5][0-9][0-5][0-9] $echo $? 1 $ It appears the output from egrep when run in directory /dir1/dir2/dir3 is the opposite of what I would expect /dir1/dir2/dir3 and /dir1/dir2/dir3/dir4 are on the same volume. I have checked and there is only one instance of egrep on the whole server. The permissions of the directories are as follows drwxr-xr-x /dir1/dir2 drwxrwxrwx /dir1/dir2/dir3 drwxr-xr-x /dir1/dir2/dir3/dir4 We can’t work out why this is happening. Can anyone help? Many thanks Helen |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
if there is a . in your PATH variable does it come before /usr/bin ?
|
|
#3
|
|||
|
|||
|
There is a . in the path but it is the very last item. I have done a 'which egrep' in each of the directories and they all point to the same egrep.
|
|
#4
|
|||
|
|||
|
Use full path
It's very wierd.
Can you try echo 00000 | /usr/bin/egrep .... just to avoid path suspisions? |
|
#5
|
||||
|
||||
|
Quote:
Also post your OS and version - I could not duplicate your problem on Solaris 2.6. |
|
#6
|
|||
|
|||
|
It came out with the same output
$echo 000000 |/usr/bin/egrep -v [0-1][0-9][0-5][0-9][0-5][0-9] 000000 I also tried this which was interesting: $echo 000000 |/usr/bin/egrep -v [0-1] $echo 000000 |/usr/bin/egrep -v [0-1][0-9] $echo 000000 |/usr/bin/egrep -v [0-1][0-9][0-5] $echo 000000 |/usr/bin/egrep -v [0-1][0-9][0-5][0-9] $echo 000000 |/usr/bin/egrep -v [0-1][0-9][0-5][0-9][0-5] $echo 000000 |/usr/bin/egrep -v [0-1][0-9][0-5][0-9][0-5][0-9] 000000 $ Its bizarre. |
|
#7
|
||||
|
||||
|
use the path when using the echo command instead of possibly using the shell's echo.
Also, I got mine to error with the same output by adding an extra [0-9] on the egrep. |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|