User Profile

Collapse

Profile Sidebar

Collapse
drjay
drjay
Last Activity: Mar 25 '08, 07:54 PM
Joined: Mar 18 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • drjay
    started a topic Newbie...parsing from multiple lines.
    in Perl

    Newbie...parsing from multiple lines.

    I'm trying to get my script to parse a bunch of files and grab data between the <title></> and <blah></> tags. Yes yes, I'm parsing html with regex, it works though. :)

    The issue I have is sometimes there is one line, sometimes 30 lines, between <title> and <blah> so I can't just .+ it all the way. Plus there are multiple <blah> tags in each file. I'm looking for a way for to scan the file...
    See more | Go to post
    Last edited by eWish; Mar 26 '08, 12:59 AM. Reason: Added language to code tags for readability

  • drjay
    replied to Parse multiple files...
    in Perl
    Code:
    $dir = "c:\\script";
    $outdir = "c:\\newfiles";
    
    ### DO NOT EDIT BELOW ###
    $i=1;
    print "Opening $dir\n";
    opendir(DH,$dir);
    while (defined ( my $filename = readdir(DH))) {
    	$outfilename=">\\$outdir\\$filename";
    	print "Opening $filename\n";
    	open(FHI,$filename);
    	while (<FHI>) {
    		$html .= $_;
    	}
    ...
    See more | Go to post

    Leave a comment:


  • drjay
    started a topic Parse multiple files...
    in Perl

    Parse multiple files...

    I feel like a goon. I had a script that would do this but I deleted it long ago without even thinking. Please if someone could help I would REALLY appreciate it.

    I'm looking for a script that will read all of the files in a directory and pull the data between two sets of tags and put it in a tab delimited file. Such as, find:

    <span class."inv">(.+ ?)<\/span>
    -AND-
    <td class."lister"> (.+?)<\/td>...
    See more | Go to post
No activity results to display
Show More
Working...