Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Read apps list from PSI-Probe HTML output and print as plain text
#!/usr/bin/perl
use strict;
use warnings;
use XML::LibXML;
die "Usage: $0 file.html\n" if @ARGV != 1;
my $dom = XML::LibXML->load_html(
location => $ARGV[0],
recover => 1,
suppress_errors => 1,
);
my $xpath = '//div/table//tr';
my @nodes = $dom->findnodes($xpath)->to_literal_list;
shift @nodes; #..strip header
foreach (@nodes) {
my @a = split/[\r\n]+/;
my @b = map { /^\s*(.+)\s*$/ ? $1 : $_ } @a;
my @c = grep !/^\s*$/, @b;
my $d = join(' -- ', @c);
print $d, "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment