AWK: Parse lvdisplay


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting AWK: Parse lvdisplay
# 1  
Old 10-26-2010
AWK: Parse lvdisplay

Hi,

I would like to parse the next output of an lvdisplay -v using awk:

Code:
--- Logical volumes ---
LV Name                     /dev/vg01/lvol3
VG Name                     /dev/vg01
LV Permission               read/write
LV Status                   available/syncd
Mirror copies               0
Consistency Recovery        MWC
Schedule                    striped
LV Size (Mbytes)            368640
Current LE                  23040
Allocated PE                23040
Stripes                     4
Stripe Size (Kbytes)        1024
Bad block                   NONE
Allocation                  strict
IO Timeout (Seconds)        default

   --- Distribution of logical volume ---
   PV Name                 LE on PV  PE on PV
  /dev/dsk/c9t0d5         5738      5738
  /dev/dsk/c9t0d6         5738      5738
  /dev/dsk/c9t0d7         5738      5738
  /dev/dsk/c9t1d0         5738      5738
  /dev/dsk/c9t1d1         22        22
  /dev/dsk/c9t1d2         22        22
  /dev/dsk/c9t1d3         22        22
  /dev/dsk/c9t1d4         22        22

   --- Logical extents ---
   LE    PV1                     PE1   Status 1
   00000 /dev/dsk/c9t0d5         00000 current
   00001 /dev/dsk/c9t0d6         00000 current
   00002 /dev/dsk/c9t0d7         00000 current
   00003 /dev/dsk/c9t1d0         00000 current
   00004 /dev/dsk/c9t0d5         00001 current
[...]
[...]
[...]

I would like to obtain the text marked in bold. I tried to get it using RS="---" of awk but I don't know how to obtain only X record..


Any comments is apreciated.

Thanks
# 2  
Old 10-26-2010
Try...
Code:
 
awk '$1~/^\/dev\/dsk/{print $1}'

This User Gave Thanks to malcomex999 For This Post:
# 3  
Old 10-26-2010
Thanks!!! I didn't see all lines I want start by /dev.. Smilie

Thanks again!!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using awk to Parse File

Hi all, I have a file that contains a good hundred of these job definitions below: Job Name Last Start Last End ST Run Pri/Xit ________________________________________________________________ ____________________... (7 Replies)
Discussion started by: atticuss
7 Replies

2. Shell Programming and Scripting

awk to parse df output

Output of the below code includes unmatched date.Please correct it df -k|awk '$4>50 {print $1, "\t"$4,"\t" $7}' It gives output less than 50% also. (5 Replies)
Discussion started by: vinil
5 Replies

3. Shell Programming and Scripting

Parse a file using awk

Hi Experts, I am trying to parse the following file; FILEA a|b|c|c|c|c a|b|d|d|d|d e|f|a|a|a|a e|f|b|b|b|boutput expected: a<TAB>b <TAB><TAB>c<TAB>c<TAB>c<TAB>c<TAB> <TAB><TAB>d<TAB>d<TAB>d<TAB>d<TAB> e<TAB>f <TAB><TAB>a<TAB>a<TAB>a<TAB>a<TAB> <TAB><TAB>b<TAB>b<TAB>b<TAB>b<TAB>*... (7 Replies)
Discussion started by: rajangupta2387
7 Replies

4. Shell Programming and Scripting

Parse input -AWK

Input File Defined configuration: cfg: CLL_DCC_Fabric_A BTS00P21; BAU_AP00P01QC; BAU_LGSCNJP02; BAU_TS00P20; BAU_DSMSM14; BAU_HT00P02; BAU_DSMSM13; BAU_HT00P01; cfg: CX0014_list BAU_TS00P20; BAU_NYP_PRODIAD1_CJ;... (5 Replies)
Discussion started by: greycells
5 Replies

5. Shell Programming and Scripting

Parse a file with awk?

Hi guys (and gals). I need some help. I'm running an IVR purely on Asterisk where I capture the DTMFs. After pulsing each DTMF I have Asterisk write to a file with whatever was dialed (mostly used for record-keeping) and at the end of the survey I write all variables in a single line to a... (2 Replies)
Discussion started by: tulf210
2 Replies

6. Shell Programming and Scripting

Parse file using awk and work in awk output

hi guys, i want to parse a file using public function, the file contain raw data in the below format i want to get the output like this to load it to Oracle DB MARWA1,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 MARWA2,BSS:26,1,3,0,0,0,0,0.00,22,22,22.00 this the file raw format: Number of... (6 Replies)
Discussion started by: dagigg
6 Replies

7. UNIX for Dummies Questions & Answers

awk to parse a directory name?

Hi, I have a directory file name: /auto/space/user/jen/CED/CED_01MZ/visit1/DCE_2eco/016/echo1 I would like to just get the following outputs into variables such that: variable1 = /auto/space/user/jen/CED/CED_01MZ/visit1/ and variable2 = DCE_2eco/016/echo1 I've tried it with... (2 Replies)
Discussion started by: nixjennings
2 Replies

8. UNIX for Dummies Questions & Answers

parse string with awk

Hi Guys, I spend half a day getting this to work with no luck, perhaps you guys can help.. I have a string from a file looking like this: module::name=test::type=generic_data::exec=snmpget.......::desc=A Little Test::interval=300 what I would like to split it, so I get a value for each... (3 Replies)
Discussion started by: hyber
3 Replies

9. Shell Programming and Scripting

AWK unable to parse

awk -v new=" " ' substr($0, 17, 3) == "ABC" && substr($0, 52, 8) == "00000000" { tr=substr($0, 20, 10); ap=substr($0, 30, 2); ver=substr($0, 32, 2); irver=substr($0, 34, 2); ... (12 Replies)
Discussion started by: COD
12 Replies

10. HP-UX

lov4 stale found in lvdisplay

hi All I have one RP 3410 server with hp-ux 11.23 mirror disk it's lvdislay -v /dev/vg00/lvol4 shows stale in some location Actual is current pls help me to resolve the probem I have check with lvsync command and vgsync but not working re Rajesh (1 Reply)
Discussion started by: rajeshtt32
1 Replies
Login or Register to Ask a Question