Last active
October 6, 2024 09:53
-
-
Save met/be83e2e06db0a02a8a187ff1224d3526 to your computer and use it in GitHub Desktop.
Show all characters used in Prague public transit stop_names, headsigns and route_short_names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Download static GTFS for Prague PID and show all used characters in stop_names, trip_headsigns and, route_short_names | |
# Require: curl, unzip and duckdb | |
GTFS_PID_URL='https://data.pid.cz/PID_GTFS.zip' | |
GTFS_ZIP_FILEMAME='pid_gtfs.zip' | |
GTFS_DIRNAME='pid_gtfs' | |
# check for file GTFS_ZIP_FILEMAME | |
if [[ ! -e "$GTFS_ZIP_FILEMAME" ]]; then | |
curl "$GTFS_PID_URL" --output "$GTFS_ZIP_FILEMAME" | |
fi | |
# check for directory GTFS_DIRNAME | |
if [[ ! -d "$GTFS_DIRNAME" ]]; then | |
unzip pid_gtfs.zip -d "$GTFS_DIRNAME" | |
fi | |
cd "$GTFS_DIRNAME" | |
duckdb -csv -noheader -c "SELECT stop_name FROM read_csv_auto('stops.txt')" | grep -o . | sort | uniq | tr -d '\n' | |
echo | |
# "&()+,-./0123456789=ABCDEFGHIJKLMNOPRSTUVWXYZabcdefghijklmnopqrstuvwxyzÁÚáéíóöúüýČčĎďěňŘřŠšťůŽž | |
duckdb -csv -noheader -c "SELECT trip_headsign FROM read_csv_auto('trips.txt')" | grep -o . | sort | uniq | tr -d '\n' | |
echo | |
# "&(),-./1ABCDEFGHIJKLMNOPRSTUVWYZabcdefghijklmnopqrstuvxyzÁÖÚáéíóúüýČčĎďěňŘřŠšťůŽž✈ | |
duckdb -csv -noheader -c "SELECT route_short_name FROM read_csv_auto('routes.txt')" | grep -o . | sort | uniq | tr -d '\n' | |
echo | |
# "0123456789ABCDEHKLMNOPRSTUVXYceilrÍŠ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment