Re: run cmd, writing output to log file

2021-10-07 Thread hput
Ken Slater writes: [...] snip >> --- --- ---=--- --- --- >> At first glace, looks like $log was used instead of instead of $fh. >> Andy Bach writes: > What Ken said: > > while (<$ch>) { > print $fh "$PaddedDateStr $_"; > } Thx to both of you.

Re: run cmd, writing output to log file

2021-10-05 Thread Andy Bach
What Ken said: while (<$ch>) { print $fh "$PaddedDateStr $_"; } On Tue, Oct 5, 2021 at 2:46 PM Ken Slater wrote: > > > On Tue, Oct 5, 2021 at 3:35 PM reader wrote: > >> Whenever I don't do scripting for longish periods, next time I start >> writing a perl script, an awful lot of usefu

Re: run cmd, writing output to log file

2021-10-05 Thread Ken Slater
On Tue, Oct 5, 2021 at 3:35 PM reader wrote: > Whenever I don't do scripting for longish periods, next time I start > writing a perl script, an awful lot of useful info has flew right out > of my pea brain. > > I was pretty sure I have written perl scripts that wrote to log files > with out prob

run cmd, writing output to log file

2021-10-05 Thread reader
Whenever I don't do scripting for longish periods, next time I start writing a perl script, an awful lot of useful info has flew right out of my pea brain. I was pretty sure I have written perl scripts that wrote to log files with out problems but the script below does not. Instead if throws thi

Re: Data::Dumper Output

2019-01-25 Thread Andrew Solomon
Hi James, It looks like the object is based on a scalar. To see what I mean, play with the code below. In the case of the output in your email, I suspect the class name would have been on the line after "bless" cheers, Andrew #!/usr/bin/env perl use strict; use warnings; use fe

Data::Dumper Output

2019-01-25 Thread James Kerwin
Hi All, I needed to slightly alter the behaviour of a module I use in Perl. In order to see the data structure I used Data:Dumper to get an output so I could find the piece that I required for the change of logic. To my shock and horror it gave me this: $VAR1 = bless( do{\(my $o

Re: IPC::Open3 and output

2017-07-10 Thread Chas. Owens
o the shell redirecting STDERR into STDOUT), but the filehandle resulting from the open3 will only have the STDERR from the command. This might have something to do with the amount/timing of output available. On Mon, Jul 10, 2017 at 10:09 AM Mike Martin wrote: > Thanks for that, now I have anoth

Re: IPC::Open3 and output

2017-07-10 Thread Mike Martin
Thanks for that, now I have another issue. Unlike a piped open, open 3 does not seem to produce output immediately Is there any way to use pipes with open3 so that the FH has content before looping ie: this produces output my $pid=open($file, "-|","$cmd{$sopts->{subname}}

Re: IPC::Open3 and output

2017-07-09 Thread Chas. Owens
> > local(*HIS_IN, *HIS_OUT, *ERR); > my $cmd='ffmpeg'; > my $pid=open3(undef, undef, *ERR,$cmd, @args) or die print "$!"; > my $line; > > while (sysread ERR, $line, 256){ > print $line; > } > waitpid($pid, 0); > > However the output is buffered for

IPC::Open3 and output

2017-07-09 Thread Mike Martin
@args) or die print "$!"; my $line; while (sysread ERR, $line, 256){ print $line; } waitpid($pid, 0); However the output is buffered for around 2 minutes at a time rather immediately being printed Is there any way around this

Re: Time::HiRes output

2017-05-27 Thread SSC_perl
> On May 24, 2017, at 7:17 PM, Chas. Owens wrote: > > Take a look at Devel::NYTProf... Thanks, Chas. I had made a mental note a while back to look into Devel::NYTProf, but it had slipped my mind, so your response was perfectly timed. Just within the first hour of using it,

Re: Time::HiRes output

2017-05-24 Thread lee
nsubscribe, e-mail: beginners-unsubscr...@perl.org >> For additional commands, e-mail: beginners-h...@perl.org >> http://learn.perl.org/ >> >> >> There's a method provided by Time::HiRes called 'interval' or the like which might give you nicer output.

Re: Time::HiRes output

2017-05-24 Thread Chas. Owens
You can use printf or sprintf to control the format, but what you are doing is called profiling and it is better to use an actual profiler. Take a look at Devel::NYTProf http://search.cpan.org/~timb/Devel-NYTProf-6.04/lib/Devel/NYTProf.pm https://www.perl.org/about/whitepapers/perl-profiling.html

Time::HiRes output

2017-05-24 Thread SSC_perl
I’m timing sub routines to get an idea of where my scripts spend the most of their time. This is an example of what I’m doing: use Time::HiRes qw( clock ); my $clock0 = clock(); ... # Do something. my $clock1 = clock(); my $clockd = $clock1 - $clock0; I’m getting values like $cl

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-20 Thread lee
Shekar writes: > Depending upon how vendor implemented SNMP part for their device, other > than standard OID's such as sysUptime , will have custom MIB files. > You should try visiting their website for downloading required MIB file for > your switch. > Then import them with -m or put it under sn

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-20 Thread lee
mailing lists writes: > are you sure? > > # emerge -s expect >     > [ Results for search key : expect ] > Searching... > > [...] > *  dev-perl/Expect >   Latest version available:

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Shekar
Depending upon how vendor implemented SNMP part for their device, other than standard OID's such as sysUptime , will have custom MIB files. You should try visiting their website for downloading required MIB file for your switch. Then import them with -m or put it under snmp path to get its OID's wo

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
lee writes: > Shekar writes: > >> +1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? > > Thanks! 'Expect' isn't available as Gentoo package, so I skipped it. > > SNMP is probably better, so I need to learn about that first and see if > I can use it. I guess it's time to

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
Shekar writes: > +1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? Thanks! 'Expect' isn't available as Gentoo package, so I skipped it. SNMP is probably better, so I need to learn about that first and see if I can use it. I guess it's time to learn about SNMP anyway :

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Shekar
+1 for SNMP, or if Net::SSH::Perl didn't help, can you try expect module? Cheers, Shekar On Wed, Apr 19, 2017 at 1:38 PM, lee wrote: > Duncan Ferguson writes: > > > If the temperature is available on your switch, can you not enable SNMP > on it and read the specific OID to get the info? Far

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
Duncan Ferguson writes: > If the temperature is available on your switch, can you not enable SNMP on it > and read the specific OID to get the info? Far far easier than trying to > keep an ssh connection open, I think. > > I guess this does depend on the switch type and whether the info is ava

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread lee
SSC_perl writes: >> On Apr 18, 2017, at 6:19 PM, lee wrote: >> >> The purpose is to get room temperature readings > > Hey Lee, > > I don’t have a solution for you, but I have an idea that might > help. Have you tried the Misterhouse mailing list? It’s a Perl > script that handles sensor

RE: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-19 Thread Duncan Ferguson
, though. Duncs -Original Message- From: lee [mailto:l...@yagibdah.de] Sent: 19 April 2017 02:20 To: beginners@perl.org Subject: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output? Hi, I'm trying to repeatedly ex

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread X Dungeness
Hm, IIUC can't the remote script sleep-loop and send output back asynchronously. (More reseach needed on async piece).. $ssh->system('/path/to/remote_script arg, arg,...'); #!/bin/... # remote_script for (...); do get_temp_probe(); . ; sleep 300; done On Tue, Ap

Re: how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread SSC_perl
> On Apr 18, 2017, at 6:19 PM, lee wrote: > > The purpose is to get room temperature readings Hey Lee, I don’t have a solution for you, but I have an idea that might help. Have you tried the Misterhouse mailing list? It’s a Perl script that handles sensors like that so someone there

how to repeatedly execute a command on a remote machine via a shh login from within a perl program capturing the output?

2017-04-18 Thread lee
Hi, I'm trying to repeatedly execute a command on a remote machine and to capture the output with a perl program. I have tried Net::OpenSSH and Net::SSH::Perl. Both log in, execute the command, capture the output --- and then log out. According to the log file of the remote machine

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-16 Thread Chris Fedde
ipt takes that input, processes it, and writes is as a change > to an output file. > > I use Path::Tiny, and this works ok, > > use Path::Tiny qw(path); > > my $newdata = $@; > $newdata = (some processing); > > my $file = path('/hom

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread Chas. Owens
snip > So I guess the question is - > > - is there a way in perl to authorize the callED perl script to have > higher perms than the callING app's, so that it can write to the file I'm > targeting? > > Or do I have to to this OUTSIDE of the perl script? > The short answer is that this is OS depen

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread alanj
uss with. Not sure yet. > Can you please show your real program and data input, together with the > output you want? We will also need to understand what parameters are being > passed to your program, and where it gets the new values for user and group. Here's the latest, current

Re: How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread Rob Dixon
OUP` items in the config file `out.txt`, but it's far from clear where your new values come from. Are they both in `$newdata` somehow? And how do you imagine your program will make two unrelated changes with only a single substitution? You say > output file gets CHANGED to ownership

How to get a called perl script to write output to a file with DIFFERENT user:group than the calling app?

2017-01-15 Thread alanj
I have an application that calls a perl script, feeding it input over STDIN. The perl script takes that input, processes it, and writes is as a change to an output file. I use Path::Tiny, and this works ok, use Path::Tiny qw(path); my $newdata = $@; $newdata = (some

Re: Storing Output file.

2016-02-02 Thread Frank Vino
would you remember to Reply All to the list as well? >>> >>>> >>> >>>> It just seems that the path is not included in @INC >>> >>>> You can check on the command line: >>> >>>> >>> >>>>

Re: Storing Output file.

2016-02-02 Thread Jonathan Harris via beginners
t; >>>> >> >>>> Anyways, it's easily fixed. >> >>>> >> >>>> At the start of the script, use: >> >>>> >> >>>> use lib 'C:\Perl64\cpan\build'; >> >>>> us

Re: Storing Output file.

2016-02-02 Thread Frank Vino
>>>> > >>>> At the start of the script, use: > >>>> > >>>> use lib 'C:\Perl64\cpan\build'; > >>>> use File::Slurp qw( :edit ); > >>>> > >>>> However, this would have to be added to every s

Re: Storing Output file.

2016-02-01 Thread John SJ Anderson
> On Feb 1, 2016, at 05:34, Thomas J Hughes wrote: [ snip ] This is *completely* inappropriate for the perl-beginners list, or as an off-list reply to a message received from the list. If you don't want to get email related to people trying to learn the Perl language, I suggest you make use o

Re: Storing Output file.

2016-02-01 Thread Andrew Solomon
gt;>>> >>>> However, this would have to be added to every script. >>>> If the path is an issue for all scripts, then it would be better to make >>>> the change permanent. >>>> There are good instructions here to adding the Environment Variable: >&

Re: Storing Output file.

2016-02-01 Thread Danny Spell
the Environment Variable: >>> >>> >>> http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations >>> >>> Good luck! >>> Jon >>> >>> >>> On Fri, Jan 29, 2016 at 4:08 AM, Frank Vino >>> wrote

Re: Storing Output file.

2016-02-01 Thread Thomas J Hughes
-find-perl-modules-in-non-standard-locations >> >> Good luck! >> Jon >> >> >> On Fri, Jan 29, 2016 at 4:08 AM, Frank Vino wrote: >> >>> Hi Jonathan, >>> >>> I am using Windows OS i tried but i got some error message i am >>

Re: Storing Output file.

2016-01-29 Thread Frank Vino
com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations > > Good luck! > Jon > > > On Fri, Jan 29, 2016 at 4:08 AM, Frank Vino wrote: > >> Hi Jonathan, >> >> I am using Windows OS i tried but i got some error message i am attaching >> the

Re: Storing Output file.

2016-01-29 Thread Frank Larry
; You can probably achieve this easily with 'sed' on bash. >>> >>> On 28 Jan 2016, at 09:37, Frank Larry wrote: >>> >>> Hi Team, >>> >>> could you please let me? i have a file which contains "Debug", i would >>> lik

Re: Storing Output file.

2016-01-29 Thread Jonathan Harris via beginners
Hi Shlomi, Thanks for that pointer. I read your linked pages and it doesn't seem that there is yet a solution as simple as the 'edit_file' method. Shame as it was so handy, but the arguments against it are quite compelling. @Frank - looks like the original scripting with printing to file handles

Re: Storing Output file.

2016-01-29 Thread Shlomi Fish
Hi Jonathan, On Thu, 28 Jan 2016 17:57:19 + Jonathan Harris via beginners wrote: > Hi, > I found that this works, assuming that the module is installed. > > #!/usr/bin/perl > use warnings; > use strict; > use File::Slurp qw ( :edit ); using File::Slurp is no longer recommended: http://blo

Re: Storing Output file.

2016-01-29 Thread Shlomi Fish
", when i ran the below program the out > > showing Error message but how to save the output with new changes. Could > > you please tell me how to fix it? > > The way to do this within a larger Perl program is to open a new output file, > copy all of the possibly-modified l

Re: Storing Output file.

2016-01-29 Thread Jonathan Harris via beginners
to adding the Environment Variable: http://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations Good luck! Jon On Fri, Jan 29, 2016 at 4:08 AM, Frank Vino wrote: > Hi Jonathan, > > I am using Windows OS i tried but i got some error message i am attaching &

Re: Storing Output file.

2016-01-28 Thread Frank Larry
a file which contains "Debug", i would >> like to replace debug to "Error", when i ran the below program the out >> showing Error message but how to save the output with new changes. Could >> you please tell me how to fix it? >> >> open(FILE, "> >> while($line = ){ >>print "Before substituting: ", $line ,"\n"; >> $line =~ s/Debug/Error/g; >> print "After substituting : ", $line , "\n"; >> } >> >> close(FILE); >> >> >> -Franky >> >> >

Re: Storing Output file.

2016-01-28 Thread Frank Vino
t;> >> > On Jan 28, 2016, at 1:37 AM, Frank Larry >> wrote: >> > >> > Hi Team, >> > >> > could you please let me? i have a file which contains "Debug", i would >> like to replace debug to "Error", when i ran the below pr

Re: Storing Output file.

2016-01-28 Thread Jonathan Harris via beginners
; > > On Jan 28, 2016, at 1:37 AM, Frank Larry > wrote: > > > > Hi Team, > > > > could you please let me? i have a file which contains "Debug", i would > like to replace debug to "Error", when i ran the below program the out > showing Erro

Re: Storing Output file.

2016-01-28 Thread Jim Gibson
> On Jan 28, 2016, at 1:37 AM, Frank Larry wrote: > > Hi Team, > > could you please let me? i have a file which contains "Debug", i would like > to replace debug to "Error", when i ran the below program the out showing > Error message but how to sa

Re: Storing Output file.

2016-01-28 Thread Malisetti Ram Murthy
h contains "Debug", i would > like to replace debug to "Error", when i ran the below program the out > showing Error message but how to save the output with new changes. Could > you please tell me how to fix it? > > open(FILE, " > while($line = ){ >

Re: Storing Output file.

2016-01-28 Thread Lars Noodén
Debug", i would like >> to replace debug to "Error", when i ran the below program the out showing >> Error message but how to save the output with new changes. Could you please >> tell me how to fix it? >> >> open(FILE, "> >> while($li

Re: Storing Output file.

2016-01-28 Thread Andrew Solomon
hich contains "Debug", i would > like to replace debug to "Error", when i ran the below program the out > showing Error message but how to save the output with new changes. Could > you please tell me how to fix it? > > open(FILE, " > while($line = ){

Re: Storing Output file.

2016-01-28 Thread Logust Yu via beginners
e below program the out showing > Error message but how to save the output with new changes. Could you please > tell me how to fix it? > > open(FILE, " > while($line = ){ >print "Before substituting: ", $line ,"\n"; > $line =~ s/Debug/Er

Storing Output file.

2016-01-28 Thread Frank Larry
Hi Team, could you please let me? i have a file which contains "Debug", i would like to replace debug to "Error", when i ran the below program the out showing Error message but how to save the output with new changes. Could you please tell me how to fix it? open(FILE,

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
All I can say is,, I've not had a good day. This is the correct code for getting the most popular value. I'd forgot to update $count with $value foreach my $field (keys %found) { # foreach field my $value=''; my $count=0; foreach my $key (keys %{$found{$field}}) { # foreach field -> value

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
Below is my revised code based on your comments. It is tidier but more importantly it works correctly. Ironically, it didn't actually work correctly before on my dev machine either,– it didn't find all matches. It looks like using my original code it was only using the first element in each

Re: script to parse OCR output different between servers

2015-07-22 Thread Shlomi Fish
Hi Gary, see below for my comments. On Wed, 22 Jul 2015 17:11:29 +0100 Gary Stainburn wrote: > On Wednesday 22 July 2015 16:10:18 Shlomi Fish wrote: > > Hi Gary, > > > > some comments about your code. > > > > On Wed, 22 Jul 2015 15:32:33 +0100 > > > > Gary Stainburn wrote: > > > I've written t

Re: script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
On Wednesday 22 July 2015 16:10:18 Shlomi Fish wrote: > Hi Gary, > > some comments about your code. > > On Wed, 22 Jul 2015 15:32:33 +0100 > > Gary Stainburn wrote: > > I've written the code below to parse a number of text page files > > generated by Tesseract OCR software to look for a guess the

Re: script to parse OCR output different between servers

2015-07-22 Thread Shlomi Fish
Hi Gary, some comments about your code. On Wed, 22 Jul 2015 15:32:33 +0100 Gary Stainburn wrote: > I've written the code below to parse a number of text page files generated by > Tesseract OCR software to look for a guess the most likely values for VIN, > Reg number and stock number for a veh

script to parse OCR output different between servers

2015-07-22 Thread Gary Stainburn
$field (keys %found) { # foreach field my $value=''; my $count=0; foreach my $key (keys %{$found{$field}}) { # foreach field -> value $value=$key if ($found{$field}{$key} > $count); } print STDERR "field='$field' value='$value'\n";

Re: Getting 2/8 as output

2015-06-17 Thread Uri Guttman
get info on any builtin variable: perldoc -v '$,' Handle->output_field_separator( EXPR ) $OUTPUT_FIELD_SEPARATOR $OFS $, The output field separator for the print operator. If defined, this value is printed between each of print's ar

Re: Getting 2/8 as output

2015-06-17 Thread Mike Flannigan
Thank you. I stand corrected. Interestingly, if you do "perldoc -q $," it does not explain $, but instead goes into some system with >> as the prompt. Mike On 6/17/2015 8:43 AM, Andy Bach wrote: Actually there is a $, - array display separator. http://perlmaven.

Re: Getting 2/8 as output

2015-06-17 Thread Shawn H Corey
On Wed, 17 Jun 2015 08:29:10 -0500 Mike Flannigan wrote: > If I am not mistaken there is no $, variable in Perl. > Correct me if I am wrong. http://perldoc.perl.org/perlvar.html and search for /\$OUTPUT_FIELD_SEPARATOR/ -- Don't stop where the ink does. Shawn -- To unsubscribe, e-ma

Re: Getting 2/8 as output

2015-06-17 Thread Andy Bach
Actually there is a $, - array display separator. http://perlmaven.com/output-field-separator-and-list-separator On Wednesday, June 17, 2015, Mike Flannigan wrote: > > If I am not mistaken there is no $, variable in Perl. > Correct me if I am wrong. > > I suspect that was

Re: Getting 2/8 as output

2015-06-17 Thread Mike Flannigan
If I am not mistaken there is no $, variable in Perl. Correct me if I am wrong. I suspect that was supposed to be $/. Mike On 6/17/2015 7:32 AM, beginners-digest-h...@perl.org wrote: { local $, = "\n"; print %test; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For add

Re: Getting 2/8 as output

2015-06-15 Thread Chankey Pathak
See this http://stackoverflow.com/questions/6723172/what-is-4-16-in-hashes On 13-Jun-2015 10:09 pm, "rakesh sharma" wrote: > Hi > > I am printing a hash but I tried to concatenate the new line operator and > I am getting 2/8 as output; > > print %hash."\n"

Re: Getting 2/8 as output

2015-06-15 Thread Steve Hart
{ local $, = "\n"; print %test; } On Sat, Jun 13, 2015 at 9:37 AM, rakesh sharma wrote: > Hi > > I am printing a hash but I tried to concatenate the new line operator and > I am getting 2/8 as output; > > print %hash."\n"; > > output is 2/8. I am

Re: Getting 2/8 as output

2015-06-15 Thread Shlomi Fish
Hi Sumathi, first of all note this: http://www.shlomifish.org/philosophy/computers/netiquette/email/start-new-thread.html On Mon, 15 Jun 2015 13:12:53 +0530 suMathI gOkuL wrote: > Hi Friends, > > Please suggest me some idea to write perl code to join multiple lines into > single line after a

Re: Getting 2/8 as output

2015-06-15 Thread suMathI gOkuL
13, 2015 at 10:33 PM, Илья Рассадин wrote: > Hi! > > You can use say instead of print (with use v5.10 as minimum) to avoid this > strange behaviour. > > use v5.10; > say %hash; > > but output still be ugly - all keys and values concatenates withoud > delimeter. &g

Re: Getting 2/8 as output

2015-06-13 Thread Илья Рассадин
Hi! You can use say instead of print (with use v5.10 as minimum) to avoid this strange behaviour. use v5.10; say %hash; but output still be ugly - all keys and values concatenates withoud delimeter. if you want to dump your hash for debugging purpose, module Data::Dumper is a great choice

Re: Getting 2/8 as output

2015-06-13 Thread Raj Barath
You can go over the hash using for loop like for ( keys %hash ){ print $_ => $hash{$_}. "\n"; } On Jun 13, 2015 1:40 PM, "rakesh sharma" wrote: > Hi > > I am printing a hash but I tried to concatenate the new line operator and > I am getting

Getting 2/8 as output

2015-06-13 Thread rakesh sharma
Hi I am printing a hash but I tried to concatenate the new line operator and I am getting 2/8 as output; print %hash."\n"; output is 2/8. I am not able to make the output. 2 could be the items in the hash, which in my case was 2.Any inputs? thanksrakesh

Open output file in same endianess as input file – UTF-16be vs. UTF-16le

2015-03-04 Thread Hans Ginzel
Can you please answer this question? http://stackoverflow.com/questions/28857025/perl-open-output-file-in-same-endianess-as-input-file-utf-16be-vs-utf-16le When Perl opens an UTF-16 encoded file, open my $in, "< :encoding(UTF-16)", "text-utf16le.txt" or die "Erro

Re: parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-19 Thread Mike Raynham
ly) > additional values for the key. > > Here is one real-world example (excerpt from the output of VBoxManage > showvminfo vm): > Name: 'tuba', Host path: '/Users/kwolcott/Shared/tuba' (machine > mapping), writable > > What I want to parse is the part

Re: parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-16 Thread Brandon McCaig
On Tue, Dec 16, 2014 at 4:29 PM, Kenneth Wolcott wrote: > Well, I had to look at > http://perldoc.perl.org/perlrequick.html#Extracting-matches to find > out how much I had forgotten about extracting matches from a regex :-) > > This might be inefficient, but it seems to work: > > $shared_folder =~

Re: parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-16 Thread Kenneth Wolcott
> additional values for the key. >> >> Here is one real-world example (excerpt from the output of VBoxManage >> showvminfo vm): >> Name: 'tuba', Host path: '/Users/kwolcott/Shared/tuba' (machine >> mapping), writable >> >> What I

Re: parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-16 Thread Tiago Hori
ue(s) off of the key. > > The key is (possibly) space-separated and terminate by a colon, and > the value is delimited by single quotes. But there are (potentially) > additional values for the key. > > Here is one real-world example (excerpt from the output of VBoxManage > showvminf

parsing string output that isn't CSV, but similar; what module would parse these kind of key-value pairs?

2014-12-16 Thread Kenneth Wolcott
from the output of VBoxManage showvminfo vm): Name: 'tuba', Host path: '/Users/kwolcott/Shared/tuba' (machine mapping), writable What I want to parse is the part contained by single quotes. Perhaps I'd better use a capturing regex instead of split? Perhaps something l

Re: suppress the warnings output

2014-05-20 Thread 'lesleyb'
On Tue, May 20, 2014 at 01:51:44PM +0400, Yonghua Peng wrote: > Hi, > > I have resolved the problem by adding a PrintError => 0 when creating the > $dbh object. > > my $success = try { >      $dbh = DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", > $user, $passwd, {RaiseError=>1,P

Re: suppress the warnings output

2014-05-20 Thread Yonghua Peng
he code like below: > >try { >    local $SIG{'__WARN__'} = sub {}; >     $dbh = DBI->connect("dbi:mysql:database=$db;host=$host;port=$port", >$user, $passwd) or croak $DBI::errstr; >} catch { >    if ($_) { >        write_log($_); >        exit 1; > 

suppress the warnings output

2014-05-19 Thread Yonghua Peng
croak $DBI::errstr; } catch {     if ($_) {         write_log($_);         exit 1;     } }; Now everything seems work fine. The error message has been written to logs only, no output to the terminal. My question is , is it the correct way for doing this? Thanks in advance.

Output of expect commands in to Strings Solved

2014-04-03 Thread Martin G. McCormick
After further study, I probably would have had to setup a named pipe to capture expect's output in to strings which would have not bought me anything useful for this situation. We needed to know what was going on with expect as it happened, not after the fact. More study shows that

Output of expect commands in to Strings

2014-04-02 Thread Martin G. McCormick
When using the expect module in a perl program, one can log expect output to a file with a command like $exp->log_file($somefilename); You can turn off STDOUT with $exp->log_stdout(0); Is there a way to capture either the file output or expect's STDO

Re: trying to get line-by-line output of a command pipe in perl

2013-12-26 Thread Kenneth Wolcott
On Thu, Dec 26, 2013 at 5:34 PM, John W. Krahn wrote: > Kenneth Wolcott wrote: >> >> Hello; > > > Hello Kenneth, > > > >>I'm trying to obtain line-by-line output from a command pipe in perl. >> >>Unfortunately, I am firmly h

Re: trying to get line-by-line output of a command pipe in perl

2013-12-23 Thread Shlomi Fish
Hi all, On Mon, 23 Dec 2013 18:48:24 -0500 Shawn H Corey wrote: > On Mon, 23 Dec 2013 15:02:13 -0800 > Kenneth Wolcott wrote: > > > open my $fh, @cmd, "|" or die "blah: $!\n"; fails, "Unknown open() > > mode '5'" > > If you use an array, it is _not_ sent thru the shell. Try the > three-argume

Re: trying to get line-by-line output of a command pipe in perl

2013-12-23 Thread Shawn H Corey
On Mon, 23 Dec 2013 15:02:13 -0800 Kenneth Wolcott wrote: > open my $fh, @cmd, "|" or die "blah: $!\n"; fails, "Unknown open() > mode '5'" If you use an array, it is _not_ sent thru the shell. Try the three-argument open: open my $fh, '-|', @cmd or die "blah: $!\n"; fails, "Unknown open()

trying to get line-by-line output of a command pipe in perl

2013-12-23 Thread Kenneth Wolcott
Hello; I'm trying to obtain line-by-line output from a command pipe in perl. Unfortunately, I am firmly held to 5.8.8 version of perl on this specific machine :-( Apparently, creating an array for my command prevents me from including the final pipe symbol when trying to use the

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-07 Thread Gerhard Jungwirth
Hi On 06/06/2013 06:25 PM, Jim Gibson wrote: > The program will keep running, but at some point, if the program is writing > bytes to the standard output stream, the buffer for that stream will fill up. > At that point, the program will block doing a write until the buffer has been &

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread shawn wilson
at the program will be running in the background >> when I press Ctrl+s. >> >> In the below example, once I start the program after seeing “i is 5” on >> the output, if I do ctrl+s, the output resumes at I is 6 even if I press >> ctrl+q after a minute or so. >>

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Robert Wohlfarth
rl+s. > > In the below example, once I start the program after seeing “i is 5” on > the output, if I do ctrl+s, the output resumes at I is 6 even if I press > ctrl+q after a minute or so. > > I expect it to print out till say i=65 during the 1 minute and I see the > output

RE: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Nemana, Satya
sequentially. I need to try out the programs that you suggested . However I don’t accept that the program will be running in the background when I press Ctrl+s. In the below example, once I start the program after seeing “i is 5” on the output, if I do ctrl+s, the output resumes at I is 6 even if I

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Jim Gibson
On Jun 6, 2013, at 9:04 AM, Travis Thornhill wrote: > > > On Jun 5, 2013, at 4:18, "Nemana, Satya" wrote: > >> Hi >> >> I am having a slight difficulty in getting this accomplished. >> When my perl program keeps running, I sometimes need to pau

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Travis Thornhill
On Jun 5, 2013, at 4:18, "Nemana, Satya" wrote: > Hi > > I am having a slight difficulty in getting this accomplished. > When my perl program keeps running, I sometimes need to pause the screen > output and check some things on the output. > But, I want my p

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread shawn wilson
un 6, 2013 5:45 AM, "Luca Ferrari" wrote: > On Wed, Jun 5, 2013 at 1:18 PM, Nemana, Satya > wrote: > > Hi > > > > > > > > I am having a slight difficulty in getting this accomplished. > > > > When my perl program keeps running, I sometimes need

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-06 Thread Luca Ferrari
On Wed, Jun 5, 2013 at 1:18 PM, Nemana, Satya wrote: > Hi > > > > I am having a slight difficulty in getting this accomplished. > > When my perl program keeps running, I sometimes need to pause the screen > output and check some things on the output. > > But, I

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-05 Thread Shlomi Fish
Hi Satya, On Wed, 5 Jun 2013 11:18:14 + "Nemana, Satya" wrote: > Hi > > I am having a slight difficulty in getting this accomplished. > When my perl program keeps running, I sometimes need to pause the screen > output and check some things on the output. But, I

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-05 Thread James Alton
Alternatively, output to a file, don't sleep (unless you really need to?), then tail that file in another console. (This would be for if you wanted to see different parts of the "printed" output while the program is still going.) James On Wed, Jun 5, 2013 at 5:18 AM, Neman

Re: how to make perl program run continue when i press control+s to pause screen output

2013-06-05 Thread James Alton
> Hi > > ** ** > > I am having a slight difficulty in getting this accomplished. > > When my perl program keeps running, I sometimes need to pause the screen > output and check some things on the output. > > But, I want my program to still keep running

how to make perl program run continue when i press control+s to pause screen output

2013-06-05 Thread Nemana, Satya
Hi I am having a slight difficulty in getting this accomplished. When my perl program keeps running, I sometimes need to pause the screen output and check some things on the output. But, I want my program to still keep running while I pause the screen. (using ctrl+s on putty) But the program

Fwd: Receiving Output parameters of a sybase stored procedure

2013-01-16 Thread kavita kulkarni
More details: Procedure results from DB prompt: [23] DEV03.dfirm002.1> declare @ret_val int, @output int [23] DEV03.dfirm002.2> exec @ret_val = prcLoadTransacMove 2012, sm3, 17, 1775162844, 2, @output out [23] DEV03.dfirm002.3> select @ret_val, @output; (return s

Receiving Output parameters of a sybase stored procedure

2013-01-16 Thread kavita kulkarni
Hello All, I want to call a sybase stored procedure from my perl script & store the output parameter of script in a variable. Script takes 5 input parameters & has one int type output prameter. Below is part of my script. Everytime I run this, I only get output as retVal = 0 (which i

  1   2   3   4   5   6   7   8   9   10   >