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

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)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.