Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: formatting output from system call

by vinoth.ree (Parson)
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


Comment on Re: formatting output from system call
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
Node Status?
node history
Node Type: note [id://1078658]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (15)
As of 2014-07-28 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (204 votes), past polls