# # Perl script to modify names of GPX waypoints in file downloaded from SOTADATA.ORG # (c) 2018, Jan Uhrin, OM2JU # License: Free, enjoy # # Example of Waypoint entry: # # <-- print this line # 1040 <-- don't print this line # OK/JC-027 <-- don't print this line # <-- don't print this line # <-- don't print this line # SOTA10 <-- don't print this line # SOTA Summit OK/JC <-- don't print this line # <-- print this line # # Iterate through all lines in text file entered as command line argument while (<>) { # By default let print everything except lines with specific tags $print_flag = 1; # This flag is activated when new assembled SOTA name is ready $print_flag_name = 0; # # Let print everything except the lines with following tags if ($_ =~ /(.*)<\/name>/) { $ref = $1; } if ($_ =~ /(.*)<\/ele>/) { $ele = $1; } if ($_ =~ /<\!\[CDATA\[(.*)\]\]><\/cmt>/) { $summit = $1; } if ($_ =~ /SOTA(.*)<\/sym>/) { $sym = $1; $print_flag_name++; } # # Print all lines except ones with $print_flag=0 print if ($print_flag>0); # # Print new SOTA name if ($print_flag_name>0) { printf(" %s, %sm, %sp - %s\n", $ref, $ele, $sym, $summit ); } }