#!/usr/bin/perl

$in_way = 0;
$buf = "";
while (my $line = <>) {
	if ($in_way && $line =~ /\s*<\/way/) {
		$in_way = 0;
		$buf = "";
		$line = "";
	}
	if ($line =~ /\s*<way/) {
		$in_way = 1;
	}
	if ($in_way) {
		$buf .= $line;
		if ($line =~ /[\s\t ]*<seg/) {
			$in_way = 0;
			print $buf;
			$buf = "";
		}
		$line = "";
	}
	print $line;
}
