BenBart wrote:
> Hi all,

Hello,

> Can anyone suggest what is the best way to convert the lines of text
> between the ========= into a delimited file?
> 
> Do I have to read the lines one at a time and append the delimiter that
> I wanted into the end of each line and then re-direct the output to a
> file? FYI, the line "Tablespaces for Current Database" is like the
> heading so the start of each record is at the line Tablespace ID.
> 
> My real objective is to convert this output into a delimited file of
> tablespace records where the starting field of the record is the
> Tablespace ID line and the ending field of the record is the Number of
> Containers. The lines Detailed explanation: and Normal are not part of
> the record.

This appears to do what you want

#!/usr/bin/perl
use warnings;
use strict;

# Set the input record separator to paragraph mode,
# the output record separator to a newline and
# the output field separator (delimiter) to a comma
( $/, $\, $, ) = ( '', "\n", ',' );

while ( <> ) {
    /Tablespace ID/ && print /=\s*(.+)/g;
    }

__END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to