Re: Newbie Help (WinXP)



For details see
http://discuss.joelonsoftware.com/default.asp?joel.3.237640.0

-- Mark

Chris wrote:
> Mark Jerde wrote:
>> There are 228 .html files I want to suck 4 items out of and put in
>> a single comma delimitted file, one line per .html file. I know how
>> to build the regular expressions to get the 4 items.
>
> OK. Show us.
>
>> I know how to do this in *.NET and VB6 but I wanted to try to do it
>> in Perl. I downloaded perl from ActiveState.com and have
>> successfully run a few programs but I'm not being successful
>> processing *.html on the command line.
>
> Why don't you show us what you've tried. Then someone can
> give pointers as to where you're going wrong.
>
>> I would really appreciate it if someone would reply with the WinXP
>> command line and the Perl program to make a single output file of
>> [Father, Mother] from *.html input. Sample input:
>>
>> 1.html
>>
>> Person=George
>> Father=Alan
>> Mother=Sarah
>> Hobby=Cheating at dice
>>
>> 2.html
>>
>> Person=Karen
>> Father=David
>> Mother=Mary
>> Hobby=Burning books
>>
>> 3.html
>>
>> Person=Mark
>> Father=Sven
>> Mother=Helga
>> Hobby=Burping
>>
>> Output file:
>>
>> Alan, Sarah
>> David, Mary
>> Sven, Helga
>>
>>
>
> In linux this works for one file at a time:
>
> perl -lne 'if (/(Father|Mother)=(\w+)/) {push @data, $2}
> END{print join(",", @data)}' 1.html
>
> I'll leave it as an exercise for the OP to modify it to
> output correctly for *.html. I could do it as a script, but
> I'm sure it's possible on a one-liner.


.



Relevant Pages

  • Re: Walking a tree and extracting info... Problems
    ... Learn to use the Perl debugger and to use the ... foreach $file (@thefiles) { ... push @lines, $_; # push the data line onto the array ... Perl has allocated "@lines" once for the whole program; when you process the next file in the directory you push the lines on the bottom; the match for the HTML title then fires every time. ...
    (comp.lang.perl.misc)
  • Re: HTTP Filtering and Threads...
    ... You are trying to parse HTML with regular expressions. ... This is not Perl. ... # Some irrelevant code stuff... ... foreach $userID { ...
    (comp.lang.perl.misc)
  • RE: question
    ... well it's really HTML that's the problem. ... > was whether perl was appropriate, not how to do it in perl. ... > this e-mail message or disclose its contents to anybody else. ... > should check this e-mail and any attachments for viruses. ...
    (perl.beginners)
  • Re: How to write to drive A: from CGI Perl
    ... >> If that does not look weird to you, then please go back to basics. ... Please (assuming that the quoted text is an actual excerpt from the HTML ... You will have a better version of Perl? ... for HTML or Perl or CGI or anything. ...
    (comp.lang.perl.misc)
  • Re: Two Perl programming questions
    ... directory names using Perl. ... I can debug through my Perl script and ... How would Perl create the dynamic HTML that I ... Perl is general purpose programming language. ...
    (comp.lang.perl.misc)