Re: Parsing Data

2013-07-23 Thread Omega -1911
Thanks Michael!! Between you and Rob, I have been able to transfer my contacts from my old cell phone to a text file on a local machine and then upload them to my database. It is a shame to have a cell company not provide a better service during an phone upgrade. You guys have helped me come up wit

Re: Parsing Data

2013-07-23 Thread John SJ Anderson
Okay, enough. This thread derail ends now. Shlomi, Rob, if you feel you need to continue this discussion in front of witnesses, feel free to continue CCing me on your private discussion -- but leave perl-beginners out of it. This type of nitpicking and sniping back and forth does not foster a welc

Re: Parsing Data

2013-07-23 Thread Rob Dixon
On 23/07/2013 19:00, Shlomi Fish wrote: Why do you feel that I've been "promoting" XML::LibXML in this thread? Because you say Instead one should use [XML::LibXML] I call that promotion. Why does the fact that I'm affiliated with it, prevent me from recommending it over a different alter

Re: Parsing Data

2013-07-23 Thread Shlomi Fish
Hi Rob, On Tue, 23 Jul 2013 18:15:07 +0100 Rob Dixon wrote: > On 23/07/2013 14:39, Shlomi Fish wrote: > > Hi Rob, > > > > I recommend against using XML::XPath because it's been undermaintained, is > > slower than XML::LibXML's XPath support, may be more incomplete and I > > believe it has poorer

Re: Parsing Data

2013-07-23 Thread Rob Dixon
On 23/07/2013 14:39, Shlomi Fish wrote: Hi Rob, I recommend against using XML::XPath because it's been undermaintained, is slower than XML::LibXML's XPath support, may be more incomplete and I believe it has poorer support for XML namespaces. Instead one should use https://metacpan.org/module/X

Re: Parsing Data

2013-07-23 Thread Shlomi Fish
Hi Rob, On Mon, 22 Jul 2013 21:48:33 +0100 Rob Dixon wrote: > On 22/07/2013 10:55, Omega -1911 wrote: > > > > Hello all - I am working on a small address book conversion where I need > > to convert a text file in where I dumped the addresses and post them to > > my database/website using the Mec

Re: Parsing Data

2013-07-22 Thread Michael Brader
On 07/23/2013 11:08 AM, Omega -1911 wrote: Rob - Thanks for the tip. I am not familiar with the module (XML::XPath) but tried to play with the code a little more to also retain the URL as well but was not successful. What would I need to modify or add to do this? After a 14 hour work day, I wo

Re: Parsing Data

2013-07-22 Thread Andy Bach
On Mon, Jul 22, 2013 at 4:55 AM, Omega -1911 <1911...@gmail.com> wrote: > Can anyone shed some light and point me in the right direction? Specifically, your REs are failing because there is a space in the data after the close quote for the class attribute that your REs don't have. This a good ex

Parsing Data

2013-07-22 Thread Omega -1911
Hello all - I am working on a small address book conversion where I need to convert a text file in where I dumped the addresses and post them to my database/website using the Mechanize module. My problem is I am trying to parse the data using the following code that is not working. Can anyone shed

RE: parsing data

2011-12-21 Thread Ken Slater
> -Original Message- > From: Chris Stinemetz [mailto:chrisstinem...@gmail.com] > Sent: Wednesday, December 21, 2011 11:18 AM > To: Binish A.R > Cc: John W. Krahn; Perl Beginners > Subject: Re: parsing data > > I'm trying to implement the advice that Bin

Re: parsing data

2011-12-21 Thread Chris Stinemetz
I'm trying to implement the advice that Binish, and John gave. I am getting the following error: Can't use an undefined value as a HASH reference at ./format.pl line 16, line 2. Any help is greatly appreciated, Chris #!/usr/bin/perl use warnings; use strict; my $csno; while( ) { chomp;

Re: parsing data

2011-12-20 Thread Binish A.R
catch    From: John W. Krahn To: Perl Beginners Sent: Wednesday, December 21, 2011 12:25 PM Subject: Re: parsing data Binish A.R wrote: > If you can guarantee the order in which the keys appear, you may not have to > build a hash to hold the entire data. &

Re: parsing data

2011-12-20 Thread John W. Krahn
Binish A.R wrote: If you can guarantee the order in which the keys appear, you may not have to build a hash to hold the entire data. Instead you can read block by block and print the result. -- my $csno; while (<>) { chomp; s/^\s+//g; s/\s+$//g; ### weed out all w

Re: parsing data

2011-12-20 Thread Binish A.R
Chris Stinemetz To: beginners@perl.org Sent: Wednesday, December 21, 2011 6:46 AM Subject: parsing data Hello list, I am having some trouble coming up with a solution for what I am trying to accomplish. Any advice is greatly appreciated. A sample of the data I would like to parse is below: I a

Re: parsing data

2011-12-20 Thread David Christensen
On 12/20/2011 05:16 PM, Chris Stinemetz wrote: I am having some trouble coming up with a solution for what I am trying to accomplish. Any advice is greatly appreciated. ... *** input *** csno=1 rfpi=1 vrp0=3423000 vrp1=3423000 trl=170 line= low= high=5 csno=1 rfpi=2 vrp0=3423000 vrp1=

parsing data

2011-12-20 Thread Chris Stinemetz
Hello list, I am having some trouble coming up with a solution for what I am trying to accomplish. Any advice is greatly appreciated. A sample of the data I would like to parse is below: I am trying to build a table like structure where the string to the left of the "=" sign is the header and t

Re: parsing data from txt file

2010-12-27 Thread Uri Guttman
> "JH" == Jugurtha Hadjar writes: JH> Hello, JH> On 12/24/2010 06:45 PM, Uri Guttman wrote: >>> "JH" == Jugurtha Hadjar writes: >> JH> my @data =0; JH> my @fields =0; JH> my @val=0; >> >> that has to be wrong. that is setting the arrays to a list with the >> e

Re: parsing data from txt file

2010-12-27 Thread Jugurtha Hadjar
Hello, On 12/24/2010 06:45 PM, Uri Guttman wrote: "JH" == Jugurtha Hadjar writes: JH> my @data =0; JH> my @fields =0; JH> my @val=0; that has to be wrong. that is setting the arrays to a list with the element 0, not an empty list. Exactly. I tried to do something like m

Re: parsing data from txt file

2010-12-24 Thread Shawn H Corey
On 10-12-24 05:10 PM, John Delacour wrote: If you're going to an empty value (which is not necessary) Don't assume it's not necessary. At one time, mod_perl did not re-initialize the data space; it just reused it so you would get the previous values in your variables. Always initialize your

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "JD" == John Delacour writes: JD> On 24 December 2010 14:49, Jugurtha Hadjar wrote: >> I rewrote your code and at the very beginning, just before any variable was >> /used/ [i.e, just after "use strict", I added >> >> >> # Intialization begins >> >> my $cell        ='';

Re: parsing data from txt file

2010-12-24 Thread John Delacour
On 24 December 2010 14:49, Jugurtha Hadjar wrote: > I rewrote your code and at the very beginning, just before any variable was > /used/ [i.e, just after "use strict", I added > > > # Intialization begins > > my $cell        =''; > my $filename    =''; If you're going to an empty value (which is

RE: parsing data from txt file

2010-12-24 Thread Jim Gibson
At 10:44 AM -0700 12/24/10, Chris Stinemetz wrote: Okay I appreciate everyones help. I feel like i am getting closer. Below is my current code and error I get. Thank you all! 1 #!/usr/bin/perl 2 use warnings; 3 use strict; 4 5 # Intialization begins 6 7 my $cell=''; 8

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "CS" == Chris Stinemetz writes: CS> 5 # Intialization begins as i said elsewhere, don't declare vars before you need them. it is noisy and in many cases redundant. CS> 6 CS> 10 my $line=''; CS> 21 my @val= (split /:/, $line); what do you think that line does? $

RE: parsing data from txt file

2010-12-24 Thread Chris Stinemetz
;Cell;Sector\n"; 47 48 #For each record, print the data to the output file: 49 50print $out join(';',@data), "\n"; 51 52 close $out; What file do you want to parse?10121807.EVDOPCMD Can't use string ("") as a symbol ref while "strict refs"

Re: parsing data from txt file

2010-12-24 Thread Uri Guttman
> "JH" == Jugurtha Hadjar writes: JH> I rewrote your code and at the very beginning, just before any JH> variable was /used/ [i.e, just after "use strict", I added this is very overkill and in some cases wrong. in general declare variable just when they are needed. when i see a long list

RE: parsing data from txt file

2010-12-24 Thread Jim Gibson
At 8:55 PM -0700 12/23/10, Chris Stinemetz wrote: Jim, Thank you for your help! My perl program contains the following code. I am getting errors when I run the program. Any insight is greatly appreciated. I gave you some program fragments to help you get started. You are going to have to u

Re: parsing data from txt file

2010-12-24 Thread Shawn H Corey
On 10-12-24 09:49 AM, Jugurtha Hadjar wrote: my @data =0; my @fields =0; my @val=0; my @data = (); my @fields = (); my @val= (); -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. Programming is as much about organization and commu

Re: parsing data from txt file

2010-12-24 Thread Jugurtha Hadjar
Hello Chris, The variables aren't /initialized/ before they're used in this code.. So, something like print $out actually won't even know what the value of $out is in the first place, let alone write in it. You mentionned "processed.txt", but it was in a comment, not in the actual code.. And

Re: parsing data from txt file

2010-12-23 Thread Brandon McCaig
On Thu, Dec 23, 2010 at 10:55 PM, Chris Stinemetz wrote: >  1 #!/usr/bin/perl >  2 >  3 use warnings; >  4 use strict; >  5 >  6 #Get data from EVDOPCMD.txt file and output to processed.txt file. >  7 >  8 print "What file do you want to parse?"; >  9 $filename = ; >  10 >  11 open( my $in, '<', $

RE: parsing data from txt file

2010-12-23 Thread Chris Stinemetz
ame at ./smart_phone.pl line 12. Global symbol "$line" requires explicit package name at ./smart_phone.pl line 12. Global symbol "$out" requires explicit package name at ./smart_phone.pl line 12. ./smart_phone.pl has too many errors. Fr

Re: parsing data from txt file

2010-12-23 Thread Jim Gibson
At 12:18 PM -0700 12/23/10, Chris Stinemetz wrote: Hello, I hope someone can help me. I am trying to parse data from a txt file and output the results to a new file with timestamp in the name of the file. Look at the open function for reading existing files and creating new ones: perldoc

Re: parsing data from txt file

2010-12-23 Thread shawn wilson
On Dec 23, 2010 2:19 PM, "Chris Stinemetz" < cstinem...@cricketcommunications.com> wrote: > > Hello, > > I hope someone can help me. I am trying to parse data from a txt file and output the results to a new file with timestamp in the name of the file. > > The format of the txt file is ";" delimite

parsing data from txt file

2010-12-23 Thread Chris Stinemetz
Hello, I hope someone can help me. I am trying to parse data from a txt file and output the results to a new file with timestamp in the name of the file. The format of the txt file is ";" delimited and is several thousand records in length. Below is an example of the .txt format. PACE | EVDOP

Re: parsing data structure

2009-06-05 Thread William
WowThank you thank you very much, Chas. Owens, that's great...appreciate that :-) William - Original Message > From: Chas. Owens > To: William > Cc: beginner perl mailling list > Sent: Friday, June 5, 2009 22:01:41 > Subject: Re: parsing data structur

Re: parsing data structure

2009-06-05 Thread Chas. Owens
On Fri, Jun 5, 2009 at 09:19, William wrote: > > I have been trying for hours, to make this data structure into hash, I need > help. Thanks. > > $str = > " >    (dr1 >        foo >        <1>(dr2 bar) >        <2>a >    ) > "; > > $hash = { >    "dr1" => { >            "<1>" => {"dr2" => {"predic

parsing data structure

2009-06-05 Thread William
I have been trying for hours, to make this data structure into hash, I need help. Thanks. $str = " (dr1 foo <1>(dr2 bar) <2>a ) "; $hash = { "dr1" => { "<1>" => {"dr2" => {"predicate"=> "bar"}}, "<2>" => "a" } }; dr1 and dr2 is

Re: Parsing Data

2005-06-29 Thread Jay Savage
On 6/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello All, > I am working on a project to roll data from an existing monitoring > product, which does not have good reporting, to RRDTOOL. Here is what I > have so far; > > > > -Sample Input--

Re: Parsing Data

2005-06-29 Thread Ing. Branislav Gerzo
[EMAIL PROTECTED] [DD], on Wednesday, June 29, 2005 at 06:39 (-0400) contributed this to our collective wisdom: DD> open(INPUT, "rrd_input.txt"); DD> open(OUTPUT, ">rrd_update.cmd"); use 'or die $!;' DD> while (INPUT) DD> { DD> ($ServerName,$DS,$Time,$Value) = Split (/\T/,$Data,4); split(

Parsing Data

2005-06-29 Thread David_Dowdy
Hello All, I am working on a project to roll data from an existing monitoring product, which does not have good reporting, to RRDTOOL. Here is what I have so far; -Sample Input-- AEPDEV02AnalyticsNT:CPUTotalCPUPct 1117778551 75.1331159

Re: Separating and parsing data

2001-12-03 Thread Trap 13
On Mon, Dec 03, 2001 at 03:00:39PM +, Sean Patterson wrote: > I just started learning Perl. I need help in writing a solution for the > following: > [ ..zap.. ] > > foreach $line (@list) { > ($time, $url, $title)=split(/|/, $line); # this does not seem to work You have t

Update: Separating and parsing data

2001-12-03 Thread Sean Patterson
I just started learning Perl. I need help in writing a solution for the following: # Write data validation routines to - # Ignore blank lines... # Ignore comments... # Ignore complete pod sections # Process the following data, as described: 792910171010163200|http://web

Separating and parsing data

2001-12-03 Thread Sean Patterson
I just started learning Perl. I need help in writing a solution for the following: # Write data validation routines to - # Ignore blank lines... # Ignore comments... # Ignore complete pod sections # Process the following data, as described: 792910171010163200|http://we