for line in ARGF
next unless %r{(\w\w\w\w)(?: \((\w\w\w)\))? (.*?)]*>([^<]*)<(?:.*?]*>([^<]*))?} === line
icao, iata, lead, page, name, page2, name2 = $1, $2, $3, $4, $5, $6, $7
if /\(not $/ === lead
page, name, page2, name2 = [page2, name2]
end
puts [icao, iata, page, name, page2, name2].join("\t")
end