Re: Assistance needed with script.......
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Sat, 17 Sep 2005 19:45:39 -0700
Bryan Jones wrote:
> Hello all,
Hello,
> I am somewhat new to perl. I have tried to read everything that I can. I
> have a somewhat simple script, so might think. I have attached the script
> and the file that I am reading to gather the data. I am trying to parse
> this file to gather information and from here I will import the data into a
> spread***. I need assistance on this one area with in the script.
>
> I have a few areas in the data file that has information that looks like the
> following:
>
> Device Capacity
> {
> Cylinders : 16
> Tracks : 240
> 512-byte Blocks : 15360
> MegaBytes : 8
> KiloBytes : 7680
> }
>
> What I am trying to do is to gather the data in between the { } so it would
> look like such
> SymmSerial =>
> symmvol =>
> $symmvol =>
> {DeviceCapacity} =>
> {512-byteBlocks} => 15360,
> {MegaBytes} => 8,
> {KiloBytes} => 7680,
>
> Above, there is only one for each symmvol. I have multiple items like this
> I would like to parse from the data file, such as Front Director Paths,
> Device Capacity(from above) and Back End Disk Director Information.
Here is one way to do it:
if ( /^\s+Device Capacity/ ) {
local $/ = '}';
$device{ $symmSerial }{ symmvol }{ $symmvol }{ devicecapacity } =
{ map split( /\s*:\s*/ ), map split( /\s*\n\s*/ ), <> =~
/\s*{\s+(.+)}/s };
}
John
--
use Perl;
program
fulfillment
.
- Follow-Ups:
- Re: Assistance needed with script.......
- From: Bryan Jones
- Re: Assistance needed with script.......
- References:
- Assistance needed with script.......
- From: Bryan Jones
- Assistance needed with script.......
- Prev by Date: Need C compiler to run under Windoze 98
- Next by Date: Re: displaying a message using perl code
- Previous by thread: Assistance needed with script.......
- Next by thread: Re: Assistance needed with script.......
- Index(es):