LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-11-2015, 12:48 PM   #1
orzune
LQ Newbie
 
Registered: Aug 2015
Posts: 1

Rep: Reputation: Disabled
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 ~]#

Last edited by orzune; 08-11-2015 at 12:49 PM. Reason: grametical incorrect
 
Old 08-11-2015, 01:01 PM   #2
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
You could try:
Code:
$ df -h | grep -wF "/usr$"
The $ means "End of Line" in a regular expression.
 
Old 08-12-2015, 03:23 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: 10 answers to the 10 most frequently asked Linux questions LXer Syndicated Linux News 0 09-04-2014 07:10 AM
Debian Linux...Which forum to look for answers or ask questions. ChulkChes Linux - Newbie 3 10-23-2012 12:56 PM
[SOLVED] linux questions and ANSWERS PLEASE! msbernice Linux - Newbie 22 07-22-2010 04:59 AM
Taranaki Linux questions and answers cctv Linux User Groups (LUG) 1 03-14-2009 06:43 AM
some linux interview questions pls post me answers shanthikumari Linux - General 4 06-14-2008 08:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration