Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: formatting output from system call

by vinoth.ree (Monsignor)
on Mar 17, 2014 at 18:58 UTC ( #1078658=note: print w/replies, xml ) Need Help??

in reply to formatting output from system call

I want to pull a value out of the output to the text file. 

You have not shown us the output and what value you want to extraxt from it.

As toolic told, you can use qx() to execute your comand and capture the output. System() call will return the exit status of your command

All is well

Replies are listed 'Best First'.
Re^2: formatting output from system call
by mark4444az (Sexton) on Mar 17, 2014 at 19:58 UTC
    The output looks like this: USB::0x0699::0x0368::C010731::INSTR <- MEASU:IMMED:VALUE? USB::0x0699::0x0368::C010731::INSTR -> 9.9E37 I would want to pull the 9.9E37 out of that. The regex part should be easy, but I'm not quite sure how that would work with qx().

      We suggested to use qx() to execute the command and capture the output, into a variable like below, instead of creating file.

      use strict; use warnings; my $output = qx(date); print $output;

      After that you can use your regx on that variable and pull the output value.

      All is well
        That is the more sensible way to do this, I will research the qx command and apply it to my script. Thankyou for your help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078658]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2018-01-23 06:58 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (240 votes). Check out past polls.