File: lines.pl

package info (click to toggle)
ooolib 0.1.7-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 312 kB
  • ctags: 65
  • sloc: perl: 1,661; makefile: 88; sh: 78
file content (21 lines) | stat: -rwxr-xr-x 443 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl
# This program takes an XML document and splits it into separate lines so that
# I can look at them and see how they work easier.

my($file) = $ARGV[0];
&Usage unless($file);
&Usage unless(-f $file);

open(FILE, $file);
while($line = <FILE>) {
    $line =~ s/\/>/\/>\n/g;
    $line =~ s/(<[^\/])/\n$1/g;
    print $line;
}
close($file);

sub Usage {
    print "Usage:\n\n";
    print "  lines.pl FILENAME.xml\n\n";
    exit;
}