1# This file is part of the Astrometry.net suite.
2# Licensed under a 3-clause BSD style license - see LICENSE
3
4function printName(name) {
5    print isngc ";" id ";" name;
6}
7
8# Skip header line.
9NR==1 { next }
10
11{
12if ($1 !~ /^(IC|NGC)[0-9]*$/) next;
13
14# Is it part of NGC or IC?
15isngc = ($1 ~ /^NGC/);
16
17# ID number.
18id = $1;
19gsub(/[A-Z]/, "", id);
20id = int(id);
21
22# Common names (comma separated).
23split($24, names, ",");
24for (i in names) {
25    printName(names[i]);
26}
27
28# Add Messier number as a common name.
29if ($19 != "") {
30    printName("M " int($19));
31}
32}
33