mrras25 has asked for the wisdom of the Perl Monks concerning the following question:
I need help with parsing a file and placing certain elements into a hash of hashes. The file I am parsing is always different based on host that the file is pulled from and basically it is a lsattr with an lsdev –C command ran after it – All I care about is the lines that read like:
............. ---- lsattr -El vgbkup ---- auto_on y N/A True conc_auto_on n N/A True conc_capable n N/A True gbl_pbufs_ppv 0 N/A True gbl_pbufs_pvg 0 N/A True timestamp 49188ced308665bd N/A True vg_pbufs_ppv 0 N/A True vgserial_id 00c0b42000004c000000011a5f8b013e N/A False ---- lsattr -El vgfrd01 ---- auto_on y N/A True conc_auto_on n N/A True conc_capable n N/A True gbl_pbufs_ppv 0 N/A True gbl_pbufs_pvg 0 N/A True timestamp 4ae7197814a6d91a N/A True vg_pbufs_ppv 0 N/A True vgserial_id 00c0b42000004c000000011a0d27a4bc N/A False .............. ---- lsattr -El loglv02 ---- copies 1 N/A True inter m N/A True intra m N/A True label None N/A True lvserial_id 00c0b42000004c000000011a5f8b013e.2 N/A False relocatable y N/A True size 1 N/A True strictness y N/A True stripe_size N/A True stripe_width 0 N/A True type jfs2log N/A True upperbound 64 N/A True ---- lsattr -El lvbackup ---- copies 1 N/A True inter x N/A True intra im N/A True label /backup N/A True lvserial_id 00c0b42000004c000000011a5f8b013e.1 N/A False relocatable y N/A True size 1200 N/A True strictness y N/A True stripe_size N/A True stripe_width 0 N/A True type jfs2 N/A True upperbound 64 N/A True ...........
The hash would go something like this:
$host_info{VG}{$vgname}{$vgid}{LV}=$lvlabel;
I need the vgname which is vgfrd01, the vgserial_id which is 00c0b42000004c000000011a0d27a4bc and I need to map the label of the lv to the vgserial number which is the same with a “.” Reference at the end.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parsing a Large file with no reason
by BrowserUk (Patriarch) on Jan 29, 2010 at 02:58 UTC | |
|
Re: Parsing a Large file with no reason
by afoken (Chancellor) on Jan 28, 2010 at 19:32 UTC | |
by mrras25 (Acolyte) on Jan 28, 2010 at 21:04 UTC | |
by roboticus (Chancellor) on Jan 29, 2010 at 02:29 UTC | |
|
Re: Parsing a Large file with no reason
by pileofrogs (Priest) on Jan 28, 2010 at 21:59 UTC | |
|
Re: Parsing a Large file with no reason
by mrras25 (Acolyte) on Jan 28, 2010 at 23:23 UTC | |
by Cristoforo (Curate) on Jan 29, 2010 at 02:25 UTC |