Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to match the output exactly? 1

Status
Not open for further replies.

signalsys

Technical User
Sep 5, 2005
44
CN
I have the following devices in my system:
hdiskpower10
hdiskpower100
hdiskpower101

Now i only want to get the information about hdiskpower10,so i use "lspv | grep hdiskpower10",but it outputs information about all the 3 devices:

hdiskpower10 vg1
hdiskpower100 vg32
hdiskpower101 vg32

What can i do to only output the information about hdiskpower10. Thanks in advance.
 
Just append a space at the end of the word to be searched for.

Code:
lspv | grep "hdisk10 "

Regards,
Khalid
 
lspv | grep 'hdiskpower10' | awk {'print "lspv " $1'} | sh

Like that?

Not sure what you really need.
 
lspv hdiskpower10

Mike

"Whenever I dwell for any length of time on my own shortcomings, they gradually begin to seem mild, harmless, rather engaging little things, not at all like the staring defects in other people's characters."
 
lspv | grep -w hdiskpower10

$ echo "hdiskpower10\nhdiskpower100\nhdiskpower1000"|grep -w hdiskpower10
hdiskpower10




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top