Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: formatting output from system call

by vinoth.ree (Monsignor)
on Mar 17, 2014 at 18:58 UTC ( [id://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.

      Ex:
      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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-03-29 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found