Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Bob Showalter am Donnerstag, 30. März 2006 23.32: > Chas Owens wrote: > > If we are going to pick nits then it should be > > > > grep -c "" fn > > Note that grep -c counts matching *lines*. There is no formal > requirement that these elements appear on separate lines. Dave, my first one-liner su

Re: Counting specific elements in a XML object

2006-03-30 Thread Bob Showalter
Chas Owens wrote: If we are going to pick nits then it should be grep -c "" fn Note that grep -c counts matching *lines*. There is no formal requirement that these elements appear on separate lines. Here's a slightly more complex Perl one-liner that counts *occurences* perl -lne '$n++ f

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Chas Owens am Donnerstag, 30. März 2006 22.35: > > > cat fn | grep | wc [...] > > grep fn | wc [...] > If we are going to pick nits then it should be > > grep -c "" fn too much work. c "" fn But your alias may be different ;-) Hans -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Counting specific elements in a XML object

2006-03-30 Thread Chas Owens
On 3/30/06, Hans Meier (John Doe) <[EMAIL PROTECTED]> wrote: > Gavin Bowlby am Donnerstag, 30. März 2006 21.45: > > How about: > > > > cat fn | grep | wc > > When I posted a "cat | grep" the first (and last) time, several people got a > well known heart attack :-) > > grep fn | wc > > > as a non-

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Gavin Bowlby am Donnerstag, 30. März 2006 21.45: > How about: > > cat fn | grep | wc When I posted a "cat | grep" the first (and last) time, several people got a well known heart attack :-) grep fn | wc > as a non-Perl approach to the problem... [...] Agreed, but OT here ;-) Hans -- To uns

RE: Counting specific elements in a XML object

2006-03-30 Thread Gavin Bowlby
How about: cat fn | grep | wc as a non-Perl approach to the problem... -Original Message- From: Hans Meier (John Doe) [mailto:[EMAIL PROTECTED] Sent: Thursday, March 30, 2006 11:38 AM To: beginners@perl.org Subject: Re: Counting specific elements in a XML object Dave Adams am

Re: Counting specific elements in a XML object

2006-03-30 Thread Hans Meier (John Doe)
Dave Adams am Donnerstag, 30. März 2006 21.12: > If I have a xml file like the following: > > > > John Doe > 43 > M > Recieving > > > Bob Gordon > 50 > M > Shipping > > > > Is there some perl module out there that can help me get

Counting specific elements in a XML object

2006-03-30 Thread Dave Adams
If I have a xml file like the following: John Doe 43 M Recieving Bob Gordon 50 M Shipping Is there some perl module out there that can help me get the number of employees or in other words, the number occurences of ""? I guess