I am writing a shell script to get the status of the logical volumes on an HP server. The command that I am using is lvdisplay, and it produces the following output:
$ lvdisplay /dev/vg00/lvol3
--- Logical volumes ---
LV Name /dev/vg00/lvol3
VG Name /dev/vg00
LV Permission read/write
LV Status available/syncd
Mirror copies 1
Consistency Recovery MWC
Schedule parallel
LV Size (Mbytes) 200
Current LE 50
Allocated PE 100
Stripes 0
Stripe Size (Kbytes) 0
Bad block off
Allocation strict/contiguous
IO Timeout (Seconds) default
The above is more info than I really need. What I would like to get this to look like is the following:
LV Name /dev/vg00/lvol3
LV Status available/syncd
Mirror copies 1
My attempt at this is to pipe the output of the lvdisplay into a perl command line program as follows:
lvdisplay /dev/vg00/lvol3 |perl -a -n -F'\n' -e'print "$F[1]\n$F[4]\n$
+F[5]\n";'
Any ideas as to how I might accomplish this?
TStanley
--------
The only thing necessary for the triumph of evil is for good men to do nothing -- Edmund Burke
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.