#!/usr/bin/perl -s use strict; my $type="-html -noent "; my $xpath=shift ; my $file=shift or die("usage: $0 xpath file\n") ; our($xml); # by defaul html $type="" if $xml; $/="/ > "; for my $f ($file, @ARGV){ open(F,"-|","echo '\ncat $xpath\n'|xmllint $type -shell '$f'") or die; while(){ chomp; print "$.:", $_; } close F; }