Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Find data between html tags

Code Block
langhtml
#!/usr/local/bin/perl
# multiliner.pl
use strict;
my $filename = shift;
open (FILE, "<", $filename)  or  die "Failed to read file $filename : $! \n";
my $whole_file;
{
    local $/;
    $whole_file = <FILE>;
}
close(FILE);
while ($whole_file =~ m#\<ul id="poweredby"\>(.*?)\<\/ul\>#gs) {
    print $1 . "\n";
}

To execute,

Code Block
langhtml
perl multiliner.pl datafile.txt