novice question: how import many lines of command output 
Author Message
 novice question: how import many lines of command output

I want to run a command from a perl program, grab the 12 or so lines
of output, and then manipulate those lines from within the perl program.
To be more explicit, the command (running under aix 3.2.2) is

           lsvg -l rootvg

and the results are:

rootvg:
LV NAME             TYPE       LPs PPs PVs  LV STATE      MOUNT POINT
hd5                 boot       2   2   1    closed/syncd  /blv
hd6                 paging     64  64  1    open/syncd    N/A
hd8                 jfslog     1   1   1    open/syncd    N/A
hd4                 jfs        1   1   1    open/syncd    /
hd2                 jfs        60  60  1    open/syncd    /usr
hd3                 jfs        2   2   1    open/syncd    /tmp
hd1                 jfs        1   1   1    open/syncd    /home
hd9var              jfs        11  11  1    open/syncd    /var
hd7                 sysdump    1   1   1    open/syncd    /mnt
hd10                jfs        28  28  1    open/syncd    /usr/sys/inst.images

I don't know how to read this output back into my program.  I've
looked through the Perl book, and I didn't see anything comparable.
Any tips?  Thanks.

 - Paul



Fri, 12 May 1995 02:21:46 GMT  
 novice question: how import many lines of command output

PS> I want to run a command from a perl program, grab the 12 or so lines
PS> of output, and then manipulate those lines from within the perl program.

If you want the lines in an array:

or:


close CMD;

or line by line.

open (CMD, "ls -l|");
for (1..12) {
    $line = <CMD> || last;
    do something with $line
    }
--
Piet* van Oostrum, Dept of Computer Science, Utrecht University,
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet



Mon, 22 May 1995 16:55:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. capturing command line error or output from `<command>`

2. Output of a command line command

3. Novice Question: Outputting an existing file

4. blank line/line of spaces (novice)

5. Command line options Input >Output how?

6. command-line output re-direction in winNT

7. Unicode output in Command Line

8. SNMP PERL module / command-line output differ

9. Capturing Command Line Output

10. capturing command-line output in NT - grrr!

11. outputting blank lines via the write command

 

 
Powered by phpBB® Forum Software