LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux questions and answers (https://www.linuxquestions.org/questions/linux-newbie-8/linux-questions-and-answers-4175550493/)

orzune 08-11-2015 12:48 PM

Linux questions and answers
 
I would like to grep fixed string "/usr" from the below command. When I used the command below it gave the output with other strings as well.Your help would be appreciated.

[root@lab~]# df -h | grep -wF "/usr"
/dev/mapper/vg00-usr 5.0G 1.8G 3.0G 38 /usr
/dev/mapper/vg00-test2 6.9G 69M 6.5G 2% /usr/data
[root@lab ~]#

rtmistler 08-11-2015 01:01 PM

You could try:
Code:

$ df -h | grep -wF "/usr$"
The $ means "End of Line" in a regular expression.

ondoho 08-12-2015 03:23 PM

maybe you wanted this?
Quote:

Originally Posted by man grep
-o, --only-matching
Print only the matched (non-empty) parts of a matching line,
with each such part on a separate output line.



All times are GMT -5. The time now is 03:24 PM.