1847283 Members
2739 Online
110263 Solutions
New Discussion

Re: scripting help!!

 
SOLVED
Go to solution
roadrunner_1
Regular Advisor

scripting help!!

I need to know all the lvm layout in a server. Iam executing lvdisplay -v /dev/dsk/cxtxdx

and I need the output to stop after it reads out the PV name. I dont need the logical extent layout..

In other words I need only the first 20-25 lines of the output....How do I use the cut command with the lvdisplay command and bring the output on the screen...
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: scripting help!!

How about piping the output to head?

Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: scripting help!!

Well, you don't use cut. You could use sed, awk, perl, but proably the easist thing to do is use head.

I assume you probably meant pvdisplay.

pvdisplay -v /dev/dsk/c1t5d0 | head -n 20
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor
Solution

Re: scripting help!!

Hi:

I think you want something like:

lvdisplay -v /dev/vg00/lvol1 |awk '/volumes/,/extents/'

Regards!

...JRF...
roadrunner_1
Regular Advisor

Re: scripting help!!

Thanks for your help...Going back to work now...other replies from now will also be assigned points...

roadrunner_1
Regular Advisor

Re: scripting help!!

ANother question for James..If I need to run this for multiple file system and pipe the same to a single file..how do i do this??

All the outputs should be copied to a single file...

Steve Steel
Honored Contributor

Re: scripting help!!

Hi

lvdisplay -v name 2>&1|grep -v current


if it is not current it may be interesting.



Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
roadrunner_1
Regular Advisor

Re: scripting help!!

I put all commands in a file with sleep in between and redirect the output to a file..and it worked....

Thanks again guys...