Re: Fwd: Parsing web pages

2017-03-03 Thread Dave Gray
The submodules WWW::Mechanize::Firefox or WWW::Mechanize::PhantomJS are worth a look too, depending on the complexity/js-heaviness of the pages you're parsing and what your setup looks like exactly (full headless; on your computer, etc). On Fri, Mar 3, 2017 at 1:39 AM, Lars Noodén wrote:

Re: Fwd: Parsing web pages

2017-03-03 Thread kavita kulkarni
Thanks all for your suggestions. Will take a look at modules and see which one works for me. Regards, Kavita :-) On Fri, Mar 3, 2017 at 12:39 AM, Lars Noodén wrote: > On 03/03/2017 02:15 AM, kavita kulkarni wrote: > > Hello, > > > > Can you suggest some effective ways to parse multiple web page

Re: Fwd: Parsing web pages

2017-03-03 Thread Lars Noodén
On 03/03/2017 02:15 AM, kavita kulkarni wrote: > Hello, > > Can you suggest some effective ways to parse multiple web pages from the > web site. > I cannot use web crawling as the format of the pages is not same. I am > interested in the data from specific table on each page. > > Thanks in advanc

Re: Parsing web pages

2017-03-02 Thread X Dungeness
Take a look a WWW::Mechanize. The older web suite LWP is an alternative and that may be enough if you only need a specific item. LWP::Simple is a possibility to see if you can mine the info from the page. If there's more complexity, then LWP::UserAgent is a starting point. A couple of books too:

Fwd: Parsing web pages

2017-03-02 Thread kavita kulkarni
Hello, Can you suggest some effective ways to parse multiple web pages from the web site. I cannot use web crawling as the format of the pages is not same. I am interested in the data from specific table on each page. Thanks in advance. Kavita

Re: newbie question for parsing incoming mails

2017-02-16 Thread Jim Gibson
> On Feb 15, 2017, at 9:56 PM, Eko Budiharto wrote: > > Jim, > I have one a couple more questions. > -. For the header, what if, I just need the subject, the from, and the > recipient, what is the command? I read the manual in the > https://metacpan.org/pod/Email::MIME#header, it does not tell

Re: newbie question for parsing incoming mails

2017-02-15 Thread Eko Budiharto
dear all, I have one a couple questions. -. For the header, what if, I just need the subject, the from, and the recipient, what is the command? I read the manual in the https://metacpan.org/pod/Email::MIME#header , it does not tell me how to extract

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
On Feb 15, 2017, at 7:10 PM, Eko Budiharto wrote: > > Jim, > if I want to extract all incoming emails from my qmail emails, how can > specify the folder location and specify the file name since the file name > always different? > > Thx. Use File::Find or opendir and readdir to find all of th

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
> On Feb 15, 2017, at 8:10 PM, Eko Budiharto wrote: > > dear Jim, > I tried to add lines to read file like this: > > use Email::MIME; > > my $file = '/var/qmail/mailnames/ name>/support/Maildir/cur/1487041394.M984019P23084V0803I00E03878.ABCD.NET,S=3987:2,'; > open my $ifh,

Re: newbie question for parsing incoming mails

2017-02-15 Thread Eko Budiharto
dear Jim, I tried to add lines to read file like this: use Email::MIME; my $file = '/var/qmail/mailnames//support/Maildir/cur/1487041394.M984019P23084V0803I00E03878.ABCD.NET,S=3987:2,'; open my $ifh, '<', $file or die "Cannot open '$file' for reading: $!"; local $/ = ''; my

Re: newbie question for parsing incoming mails

2017-02-15 Thread Eko Budiharto
Jim, if I want to extract all incoming emails from my qmail emails, how can specify the folder location and specify the file name since the file name always different? Thx. > On Feb 15, 2017, at 22:56, Jim Gibson wrote: > >> >> On Feb 14, 2017, at 10:38 PM, Eko Budiharto wrote: >> >> dear

Re: newbie question for parsing incoming mails

2017-02-15 Thread Andy Bach
> when I run it, I do not get anything. Hmm, how are you testing it. I put a single header and msg in /tmp/ml.txt (Subject: training.error Trouble wiwb) and: $ parse_email_simple.pl < /tmp/ml.txt training.error Trouble wiwb (8 lines) $ cat /tmp/ml.txt | parse_email_simple.pl training.error Trouble

Re: newbie question for parsing incoming mails

2017-02-15 Thread Jim Gibson
> On Feb 14, 2017, at 10:38 PM, Eko Budiharto wrote: > > dear all, > I have a question. > If I would like to parse all incoming mails from my qmail, which perl module > is easy to use? > my qmail emails incoming is /var/qmail/mailnames//support. In > this folder I already have preline in .qma

newbie question for parsing incoming mails

2017-02-14 Thread Eko Budiharto
dear all, I have a question. If I would like to parse all incoming mails from my qmail, which perl module is easy to use? my qmail emails incoming is /var/qmail/mailnames//support. In this folder I already have preline in .qmail for piping emails to my perl script. And, my perl script what I alread

Re: Parsing Logfiles and fetching Macs programmed and putting in another file.

2017-02-01 Thread Shlomi Fish
On Tue, 31 Jan 2017 17:29:10 +0530 Uday Vernekar wrote: > Thanks shlomi ,working on your inputs...Thanks:) > You're welcome, Uday! -- - Shlomi Fish http://www.shlomifish.org/ http://www.shlomifish.org/humour/bits/facts/Emma

Re: Parsing Logfiles and fetching Macs programmed and putting in another file.

2017-01-31 Thread Shlomi Fish
Hi Uday, see my reply interim with your code. On Tue, 31 Jan 2017 15:31:59 +0530 Uday Vernekar wrote: > Requirement: > > I have Test log files with filename as SerialNumber of tested Product and > the log file consist of > below data and other Text.the IP addresses can be repeated need to fet

Re: Parsing Logfiles and fetching Macs programmed and putting in another file.

2017-01-31 Thread Uday Vernekar
Thanks shlomi ,working on your inputs...Thanks:) On Tue, Jan 31, 2017 at 4:34 PM, Shlomi Fish wrote: > Hi Uday, > > see my reply interim with your code. > > On Tue, 31 Jan 2017 15:31:59 +0530 > Uday Vernekar wrote: > > > Requirement: > > > > I have Test log files with filename as SerialNumber o

Parsing Logfiles and fetching Macs programmed and putting in another file.

2017-01-31 Thread Uday Vernekar
Requirement: I have Test log files with filename as SerialNumber of tested Product and the log file consist of below data and other Text.the IP addresses can be repeated need to fetch only mac starting with 00:05:95:XX:XX:XX Board IP address : 192.168.1.1:ff00 Host IP addre

Re: IPv4/IPv6 parsing

2016-07-14 Thread Илья Рассадин
Hi. I used Regexp::Common here just to illustrate that before strip_port $ip_addr string doesn't match standard IPv4 regular expression and after it matches. You can construct single regular expression to test the whole string at once - something like use Regexp::Common qw/net/; |$port_re

Re: IPv4/IPv6 parsing

2016-07-14 Thread Chris Knipe
Hi, On Thu, Jul 14, 2016 at 10:28 PM, Илья Рассадин wrote: > It's really simple regexp that can handle this, I wrote simple example to > illustrate the idea. > > Of course, this $port_re can match invalid port (all port numbers which > higher than 65536). If it's critical to your case, you can

Re: IPv4/IPv6 parsing

2016-07-14 Thread Илья Рассадин
Hi! It's really simple regexp that can handle this, I wrote simple example to illustrate the idea. Of course, this $port_re can match invalid port (all port numbers which higher than 65536). If it's critical to your case, you can adjust strip port function. |use Regexp::Common qw/net/; ||m

IPv4/IPv6 parsing

2016-07-14 Thread Chris Knipe
Hi, Any modules available that can: - Parse IPv4/IPv6 addresses that includes ports (1.1.1.1:80 & ::1.80 for example) - Convert the IPv4 and IPv6 to integers There's plenty around to convert to integers, validate the address, etc. Not a lot (that I could find) that can handle an address that

Re: XML Simple + parsing inner loop elements + help

2015-12-08 Thread perl kamal
Hi, Thanks you for your valuable comments,let me try the Twig module. On 12/8/15, Kent Fredric wrote: > On 8 December 2015 at 19:25, perl kamal wrote: >> I am trying to parse the inner loop elements of the attached input xml >> elements. >> The below code doesn't retrieve the inner loop() eleme

Re: XML Simple + parsing inner loop elements + help

2015-12-08 Thread shawn wilson
tl;dr I'm not answering your specific question here. On Dec 8, 2015 1:26 AM, "perl kamal" wrote: > > Hi, > > I am trying to parse the inner loop elements of the attached input xml elements. Just fyi, I've found it easier to use xslt as an etl preprocessor to perl. I'm not sure how you intend to

Re: XML Simple + parsing inner loop elements + help

2015-12-08 Thread Kent Fredric
On 8 December 2015 at 19:25, perl kamal wrote: > I am trying to parse the inner loop elements of the attached input xml > elements. > The below code doesn't retrieve the inner loop() elements if > the properties tag contains more than one item. Will you please point > the error and correct me. >

XML Simple + parsing inner loop elements + help

2015-12-07 Thread perl kamal
Hi, I am trying to parse the inner loop elements of the attached input xml elements. The below code doesn't retrieve the inner loop() elements if the properties tag contains more than one item. Will you please point the error and correct me. Please find the attached input xml file. Thanks. use s

Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks for quick lesson and pro-tips. I'll be sure to implement some of these. In case you were wondering, I am indeed using strict and warnings. diagnostics, too. Thanks again. On 1/18/15 9:05 PM, Brandon McCaig wrote: Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: So I've g

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
Mike: On Sun, Jan 18, 2015 at 07:00:05PM -0500, Mike wrote: > So I've got a text file in a multi column format (three > columns), each column is separated by a single space. Here is a > snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > my @line = ( > @first[rand(@first)], > @second[rand(@second)], > @third[rand(@third)], >); Sorry to beat on you, Shawn, but I missed this the first time around. T

Re: Parsing multi column files

2015-01-18 Thread Charles DeRykus
On Sun, Jan 18, 2015 at 4:00 PM, Mike wrote: > So I've got a text file in a multi column format (three columns), each > column is separated by a single space. Here is a snippet for reference: > > artless base-court apple-john > bawdy bat-fowling baggage > beslubbering beef-witted barnacle > > I wa

Re: Parsing multi column files

2015-01-18 Thread Mike
Thanks. I'll give this a shot. On 1/18/15 7:44 PM, Brandon McCaig wrote: On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: You would need an array for each column: my $MAX = 10; my @first = (); my @second = (); my @third = (); sub get_columns { my $file = shift @_; o

Re: Parsing multi column files

2015-01-18 Thread Brandon McCaig
On Sun, Jan 18, 2015 at 07:24:21PM -0500, Shawn H Corey wrote: > You would need an array for each column: > > my $MAX = 10; > > my @first = (); > my @second = (); > my @third = (); > > sub get_columns { > my $file = shift @_; > > open my $fh, '<', $file or die "could not open $file: $!\

Re: Parsing multi column files

2015-01-18 Thread Shawn H Corey
On Sun, 18 Jan 2015 19:00:05 -0500 Mike wrote: > sub gen_ins { > open(FH, '<', 'insults2.txt') or die "[-] ERROR: Can't find > insult list."; > my @cols = split (" ", ); > print "$cols[0]"; > close FH; > } > > gen_ins(); > > When currently run, gen_ins() will print out the f

Parsing multi column files

2015-01-18 Thread Mike
So I've got a text file in a multi column format (three columns), each column is separated by a single space. Here is a snippet for reference: artless base-court apple-john bawdy bat-fowling baggage beslubbering beef-witted barnacle I want to be able to randomly select a word from the first col

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
On 16/12/2014 20:05, Kenneth Wolcott wrote: > Hi; > > I've got some strings that I need to parse the value(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

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
; > $shared_folder =~ m|\'([-A-Za-z/_]+)\'.+'([-A-Za-z/_]+)\'|; > print $2 . "\n"; > > > Would be good to come up with something better, hopefully... In general, parsing with regex is difficult. It depends on how complex the data is. If no single-quote

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
On Tue, Dec 16, 2014 at 12:18 PM, Tiago Hori wrote: > Have you tried Text::CSV_XS? It allows you to set both the separatist and eol > and it also lets you use complex separators. > > T. > > Sent from my iPhone > >> On Dec 16, 2014, at 4:05 PM, Kenneth Wolcott >> wrote: >> >> Hi; >> >> I've got

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
Have you tried Text::CSV_XS? It allows you to set both the separatist and eol and it also lets you use complex separators. T. Sent from my iPhone > On Dec 16, 2014, at 4:05 PM, Kenneth Wolcott wrote: > > Hi; > > I've got some strings that I need to parse the value(s) off of the key. > > T

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
Hi; I've got some strings that I need to parse the value(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 th

Re: parsing html

2013-08-08 Thread Rob Dixon
On 08/08/2013 18:18, David Precious wrote: On Thu, 8 Aug 2013 22:42:01 +0530 Unknown User wrote: What would be the best module available for parsing html in your opinion? My intention is to parse html that contains a table of 5 columns and any number of rows For parsing HTML tables, you

Re: parsing html

2013-08-08 Thread Charles DeRykus
On Thu, Aug 8, 2013 at 10:18 AM, David Precious wrote: > On Thu, 8 Aug 2013 22:42:01 +0530 > Unknown User wrote: > > > What would be the best module available for parsing html in your > > opinion? My intention is to parse html that contains a table of 5 > > columns and

Re: parsing html

2013-08-08 Thread timothy adigun
On 8 Aug 2013 18:19, "Unknown User" wrote: > > > What would be the best module available for parsing html in your opinion? I would also say look at HTML::TreeBuilder > My intention is to parse html that contains a table of 5 columns and any number of rows, and have a has

Re: parsing html

2013-08-08 Thread Chankey Pathak
Have a look at HTML::PARSER. On Aug 8, 2013 10:50 PM, "Unknown User" wrote: > > What would be the best module available for parsing html in your opinion? > My intention is to parse html that contains a table of 5 columns and any > number of rows, and have a hash ref li

Re: parsing html

2013-08-08 Thread David Precious
On Thu, 8 Aug 2013 22:42:01 +0530 Unknown User wrote: > What would be the best module available for parsing html in your > opinion? My intention is to parse html that contains a table of 5 > columns and any number of rows For parsing HTML tables, you want HTML::TableExtract, IM

parsing html

2013-08-08 Thread Unknown User
What would be the best module available for parsing html in your opinion? My intention is to parse html that contains a table of 5 columns and any number of rows, and have a hash ref like $html->{1}->{col1}=data11, $html->{1}->{col2}=data12 ... $html->{2}->{col1}=data21, $html-&

Re: Parsing a email attachment over SSL

2013-07-29 Thread John SJ Anderson
(a) Your subject line doesn't seem to have anything to do with the question in your message. (b) The documentation for Mail::IMAPClient says that the search() method arguments are appended to an IMAP SEARCH command. I think if you look at the relevent section of the IMAP RFC (https://tools.ietf.or

Parsing a email attachment over SSL

2013-07-29 Thread Chris Datfung
I get a daily email attachment to my Gmail account which I want to automatically download. I found the following Perl script which does just that: http://stackoverflow.com/questions/2453548/how-can-i-download-imap-mail-attachments-over-ssl-and-save-them-locally-using-pe The above script uses the

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
e. This a good example of why parsing html w/ REs is a fraught with fragility process. There are better REs you could create, esp. if this is a one time processs if ( /store-(\w+)[^>]+>([^>]+)>/ ) { $business_info{$1} = $2;# e.g. address => "Business Address" }

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: regexp and parsing assistance

2013-06-09 Thread Noah
On 6/9/13 9:00 AM, Jim Gibson wrote: On Jun 8, 2013, at 8:06 PM, Noah wrote: Hi there, I am attempting to parse the following output and not quite sure how to do it. The text is in columns and spaced out that way regardless if there are 0 numbers in say col5 or Col 6 or not. If the colum

Re: regexp and parsing assistance

2013-06-09 Thread Jim Gibson
On Jun 8, 2013, at 8:06 PM, Noah wrote: > Hi there, > > I am attempting to parse the following output and not quite sure how to do > it. The text is in columns and spaced out that way regardless if there are > 0 numbers in say col5 or Col 6 or not. If the column has an entry then I > want

regexp and parsing assistance

2013-06-08 Thread Noah
Hi there, I am attempting to parse the following output and not quite sure how to do it. The text is in columns and spaced out that way regardless if there are 0 numbers in say col5 or Col 6 or not. If the column has an entry then I want to save it to a variable if there is no entry then t

Re: Perl Script for parsing log files.

2013-05-08 Thread Shlomi Fish
$_] =~ m{\bfail\b}i) > { > print OUTFILE join " " => '*', @lines[ $_ - LIMIT .. $_ + > UPPERLIMIT ], $/; > } > else > { > print " No Errors found \n"; > } > > Please review if the above code seems ok . Hope it helped. > &

Re: Perl Script for parsing log files.

2013-05-08 Thread Ed Davis
} > elsif ($lines[$_] =~ m{\bfail\b}i) > { > print OUTFILE join " " => '*', @lines[ $_ - LIMIT .. $_ + UPPERLIMIT > ], $/; > } > else > { > print " No Errors found \n"; > } >

Re: Perl Script for parsing log files.

2013-05-07 Thread Asad
\b}i) { print OUTFILE join " " => '*', @lines[ $_ - LIMIT .. $_ + UPPERLIMIT ], $/; } else { print " No Errors found \n"; } Please review if the above code seems ok . Also want to know how to get this to UI(html page) interface for example a html page w

Re: Perl Script for parsing log files.

2013-04-13 Thread timothy adigun
Hi, On Sat, Apr 13, 2013 at 4:50 PM, Asad wrote: > Hi All , > > Greetings ! > >I have completed O'Reily first book Learning Perl . Started writing > small perl programs . However I basically do log file analysis , hence was > thinking is there any perl code around in any of the

Re: Perl Script for parsing log files.

2013-04-13 Thread David Precious
On Sat, 13 Apr 2013 21:20:30 +0530 Asad wrote: >I have completed O'Reily first book Learning Perl . Started > writing small perl programs . However I basically do log file > analysis , hence was thinking is there any perl code around in any of > the book or if anyone already developed for

Perl Script for parsing log files.

2013-04-13 Thread Asad
Hi All , Greetings ! I have completed O'Reily first book Learning Perl . Started writing small perl programs . However I basically do log file analysis , hence was thinking is there any perl code around in any of the book or if anyone already developed for the following requiremen

Re: parsing website

2013-02-26 Thread David Christensen
On 02/26/13 10:46, Noah wrote: I want to parse text from a website. what are some good methods and modules to do this? Any tutorial links? "Perl & LWP" is the canonical book on the subject: http://shop.oreilly.com/product/9780596001780.do HTH, David -- To unsubscribe, e-mail: begin

Re: parsing website

2013-02-26 Thread Jim Gibson
On Feb 26, 2013, at 10:46 AM, Noah wrote: > Hi there, > > I want to parse text from a website. what are some good methods and modules > to do this? Any tutorial links? I am currently using LWP::UserAgent to scrape some websites and HTML::TokeParser and HTML::TableExtract to extract links an

Re: parsing website

2013-02-26 Thread Mike
On 2/26/2013 1:46 PM, Noah wrote: Hi there, I want to parse text from a website. what are some good methods and modules to do this? Any tutorial links? Cheers WWW::Mechanize http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm -- To unsubscribe, e-mail: beginners-unsubscr...@

parsing website

2013-02-26 Thread Noah
Hi there, I want to parse text from a website. what are some good methods and modules to do this? Any tutorial links? Cheers -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-11 Thread Brandon McCaig
On Mon, Sep 10, 2012 at 02:45:20PM -0500, Andy Bach wrote: > On Mon, Sep 10, 2012 at 7:12 AM, Danny Gratzer > wrote: > > while (){ > > my ($logindate, $dbserver, $hostname, $status ) = split (/,/); > > $info{$username} = {$logindate=>[$dbserver, $hostname, $status]}; > > } > > One thing to w

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread Praveen Kumar
On Mon, Sep 10, 2012 at 5:14 PM, andrew sison wrote: > Hi, > > I'm confronted with this problem.I've done this before but I just > can't remember how. > > There is a log file I am trying to parse: > > open FILE , 'C:\test.csv' or die $!; > Use below method to open the file , $file now contain fil

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread Andy Bach
On Mon, Sep 10, 2012 at 7:12 AM, Danny Gratzer wrote: > while (){ > my ($logindate, $dbserver, $hostname, $status ) = split (/,/); > $info{$username} = {$logindate=>[$dbserver, $hostname, $status]}; > } One thing to watch for - logins on the same day will overwrite here, so while (){ my

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread Shawn H Corey
On 10 Sep 2012 13:44:20 - Peter Scott wrote: > On Mon, 10 Sep 2012 20:52:41 +0800, andrew sison wrote: > > I don't get how you can actually print the contents of the subhash. > > Generic hash-of-hashes iteration example: > > for my $outer_key ( keys %hash ) > { > print "Outer key: $outer_

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread Peter Scott
On Mon, 10 Sep 2012 20:52:41 +0800, andrew sison wrote: > I don't get how you can actually print the contents of the subhash. Generic hash-of-hashes iteration example: for my $outer_key ( keys %hash ) { print "Outer key: $outer_key:\n"; for my $inner_key ( sort keys %{ $hash{$outer_key} } )

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread andrew sison
I don't get how you can actually print the contents of the subhash. foreach my $user(keys %info){ print $info{$user}; #This gives me hash print $user, "\n"#Here I can retrieve the usernames that were made hash keys } Now here is where I hit a dead e

Re: parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread Danny Gratzer
I would create a hash with hash references containing the date and an anonymous array as members. Something like this: open FILE , 'C:\test.csv' or die $!; my %info while (){ my ($logindate, $dbserver, $hostname, $status ) = split (/,/); $info{$username} = {$logindate=>[$dbserver, $hostname, $

parsing multiple logins logs (create a unique hash name for every user)

2012-09-10 Thread andrew sison
Hi, I'm confronted with this problem.I've done this before but I just can't remember how. There is a log file I am trying to parse: open FILE , 'C:\test.csv' or die $!; while (){ my ($logindate, $dbserver, $hostname, $status ) = split (/,/); } Now I want to use the $username as a name of a has

Re: xml parsing

2012-08-16 Thread Irfan Sayed
From: Lawrence Statton To: Irfan Sayed Cc: "beginners@perl.org" Sent: Thursday, August 16, 2012 7:28 PM Subject: Re: xml parsing Okay -- I've looked at the attachment -- remember when I mentioned namespaces a while back?  This docume

Re: xml parsing

2012-08-16 Thread Lawrence Statton
Okay -- I've looked at the attachment -- remember when I mentioned namespaces a while back? This document uses one, so things get more complicated. The solution I always use for this is to put the root element into an XPath Context object and assign a prefix for the default namespace (I wa

Re: xml parsing

2012-08-16 Thread Lawrence Statton
please find the attached xml file. please suggest. regards irfan The file attached does not match the sample XML file you included in your email. The string passed to findnodes() is called an "XPath Selector" - you will need to adjust that to match the actual path of the elements you

Re: xml parsing

2012-08-16 Thread Lawrence Statton
On 08/16/2012 08:09 AM, Irfan Sayed wrote: thanks. it worked however, i cant give xml file path instead of all the contents in the start tag<< regards, irfan (BTW: The custom on this list is NOT to top post -- trim, and put your replies at the BOTTOM of the email you are responding to) Ca

Re: xml parsing

2012-08-16 Thread Irfan Sayed
thanks. it worked however, i cant give xml file path instead of all the contents in the start tag << regards, irfan From: Lawrence Statton To: beginners@perl.org Sent: Thursday, August 16, 2012 6:24 PM Subject: Re: xml parsing On 08/16/2012 07

Re: xml parsing

2012-08-16 Thread 'lesleyb'
On Thu, Aug 16, 2012 at 04:55:33AM -0700, Irfan Sayed wrote: > hi, > > i need to parse the xml file and store the data in array : > > here is the code: > use XML::Simple; > > my $ItemGroup = XMLin('C:\Users\bvcontrolbuild\Desktop\data.xml'); > > foreach my $BuildProject (@{$ItemGroup->{BuildPro

Re: xml parsing

2012-08-16 Thread Lawrence Statton
On 08/16/2012 07:46 AM, Irfan Sayed wrote: can you please give me sample code to store the xml contents to perl array using LibXML lets say xml files is as : regards irfan I'm going to assume what you wanbt is the list of Included filenames... #!/usr/bin/perl use st

Re: xml parsing

2012-08-16 Thread Irfan Sayed
12 6:07 PM Subject: Re: xml parsing Hi Irfan, On Thu, 16 Aug 2012 04:55:33 -0700 (PDT) Irfan Sayed wrote: > hi, > > i need to parse the xml file and store the data in array : > > here is the code: > use XML::Simple; > > my $ItemGroup = XMLin('C:\Users\bvcontrolbu

Re: xml parsing

2012-08-16 Thread Shlomi Fish
Hi Irfan, On Thu, 16 Aug 2012 04:55:33 -0700 (PDT) Irfan Sayed wrote: > hi, > > i need to parse the xml file and store the data in array : > > here is the code: > use XML::Simple; > > my $ItemGroup = XMLin('C:\Users\bvcontrolbuild\Desktop\data.xml'); > > foreach my $BuildProject (@{$ItemGrou

xml parsing

2012-08-16 Thread Irfan Sayed
hi, i need to parse the xml file and store the data in array : here is the code: use XML::Simple; my $ItemGroup = XMLin('C:\Users\bvcontrolbuild\Desktop\data.xml'); foreach my $BuildProject (@{$ItemGroup->{BuildProject}}) {     print $BuildProject->{Include} . "\n"; } and xml file is :  

Re: parsing script help please

2012-05-31 Thread nathalie
You want something like this: #!/software/bin/perl use warnings; use strict; my $file = "example.txt"; open my $in, '<', $file or die "Cannot open '$file' because: $!"; while ( <$in> ) { next if /^#/; chomp; my ( $key, @fields ) = split /\t/; print map "$key\t$_\n", @fields;

Re: parsing script help please

2012-05-31 Thread nathalie
thanks a lot Rob I would like an output without the $VAR... so I did add this after the push function and it is perfect, thanks a lot again foreach my $number(@othernumbers){print $rownum,"\t",$elet, "\n";} #!/usr/local/bin/perl use strict; use warnings; my $fh; my %results; open ( $fh,

Re: parsing script help please

2012-05-31 Thread John W. Krahn
nathalie wrote: Hi Hello, I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 4483180-4483486

Re: parsing script help please

2012-05-31 Thread Rob Coops
On Thu, May 31, 2012 at 11:37 AM, nathalie wrote: > > > Hi > I have this format of file: (see attached example) > 1 3206102-3207048 3411782-3411981 3660632-3661428 > 2 4481796-4482748 4483180-4483486 > > > and I would like to change it to this > 1 3206102-3207048 > 1 34117

parsing script help please

2012-05-31 Thread nathalie
Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 44

Re: Parsing repetitive lines

2012-05-03 Thread Jim Gibson
In addition to what Shlomi has mentioned, I will add: On May 3, 2012, at 4:34 AM, venkates wrote: > sub parse { > >my $pazar_file_path = shift; >my $pazar_data; # ref to a hash holding the parsed data > >open FH, '<', $pazar_file_path or croak ( "Cannot open file > '$pazar_file_pat

Re: Parsing repetitive lines

2012-05-03 Thread Shlomi Fish
Hi Aravind, On Thu, 03 May 2012 13:34:35 +0200 venkates wrote: > Hi all, > > I am trying to parse a tab-delimited file which has repeating lines. > This is causing problems while parsing it to the data structure (see > below). I would appreciate if you could help me solve th

Parsing repetitive lines

2012-05-03 Thread venkates
Hi all, I am trying to parse a tab-delimited file which has repeating lines. This is causing problems while parsing it to the data structure (see below). I would appreciate if you could help me solve this. Thanks, Aravind sub parse { my $pazar_file_path = shift; my $pazar_data

Re: Help parsing tab delimited files

2012-04-10 Thread Jim Gibson
At 5:05 AM +0100 4/10/12, Rob Dixon wrote: Jim Gibson wrote: Tiago Hori wrote: Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Almost. <> is an operator. Each time is eva

Re: Help parsing tab delimited files

2012-04-10 Thread Rob Dixon
On 10/04/2012 07:40, Dr.Ruud wrote: On 2012-04-10 06:05, Rob Dixon wrote: while () { : } is identical to while (readline FILEHANDLE) { : } which compiles as while (defined($_ = readline FILEHANDLE)) { : } Not accurate, you can check with -MO=Deparse. Please explain what you think is ina

Re: Help parsing tab delimited files

2012-04-09 Thread Dr.Ruud
On 2012-04-10 06:05, Rob Dixon wrote: while () { : } is identical to while (readline FILEHANDLE) { : } which compiles as while (defined($_ = readline FILEHANDLE)) { : } Not accurate, you can check with -MO=Deparse. -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: Help parsing tab delimited files

2012-04-09 Thread Rob Dixon
Jim Gibson wrote: Tiago Hori wrote: Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Almost. <> is an operator. Each time is evaluated, a line is read from the file and ass

Re: Help parsing tab delimited files

2012-04-09 Thread John W. Krahn
Jim Gibson wrote: On 4/9/12 Mon Apr 9, 2012 12:22 PM, "Tiago Hori" scribbled: Hey Jim, Makes perfect sense now. Thanks. Just so I make sure I understand it correctly: So every time I use a while () loop each line of input from the file gets assigned to $_ in each iteration of the loop? Al

  1   2   3   4   5   6   7   8   9   10   >