0

I am trying to execute a simple grep command in my shell script.
I am not sure why it also greps the other file system.

> df -g|grep /oracle/BP1/sapdata1
70.00 11.37 84% 21 1% /oracle/BP1/sapdata1
100.00 89.44 11% 8 1% /oracle/BP1/sapdata10
> df -g|grep /oracle/BP1/sapdata10
100.00 89.44 11% 8 1% /oracle/BP1/sapdata10

Does anyone know a work around?
Any help would be appreciated.

Thanks.
Shawn

Edited by shawnk: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by shawnk
Featured Replies
  • 1
    Salem 5,138   7 Years Ago

    grep by itself just matches strings. It doesn't care what comes before or after. Try something like [ICODE]df -g | egrep '/oracle/BP1/sapdata1$'[/ICODE] That is, the line ends with sapdata1, not just contains sapdata1 (like sapdata10 contains sapdata1) Read More

  • [QUOTE=Salem;1128261]grep by itself just matches strings. It doesn't care what comes before or after. Try something like [ICODE]df -g | egrep '/oracle/BP1/sapdata1$'[/ICODE] That is, the line ends with sapdata1, not just contains sapdata1 (like sapdata10 contains sapdata1)[/QUOTE] YES!!! that worked. You are the man... thanks. Read More

1

grep by itself just matches strings. It doesn't care what comes before or after.

Try something like df -g | egrep '/oracle/BP1/sapdata1$' That is, the line ends with sapdata1, not just contains sapdata1 (like sapdata10 contains sapdata1)

Edited by Salem: n/a

1

grep by itself just matches strings. It doesn't care what comes before or after.

Try something like df -g | egrep '/oracle/BP1/sapdata1$' That is, the line ends with sapdata1, not just contains sapdata1 (like sapdata10 contains sapdata1)

YES!!!
that worked. You are the man...

thanks.

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.