analyse-gtfs 763 B

12345678910111213141516171819202122232425262728293031323334
  1. # SPDX-FileCopyrightText: Adam Evyčędo
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. #!/bin/sh
  5. # assumes ownership of /tmp/gtfs
  6. mkdir /tmp/gtfs
  7. cp "$1" /tmp/gtfs
  8. cd /tmp/gtfs
  9. unzip "$1"
  10. printf 'translations '
  11. if [ -e translations.txt ]; then
  12. printf 'YES\n'
  13. else
  14. printf 'NO\n'
  15. fi
  16. printf 'frequencies '
  17. if [ -e frequencies.txt ]; then
  18. printf 'YES\n'
  19. else
  20. printf 'NO\n'
  21. fi
  22. cat agency.txt routes.txt stops.txt | grep -o . | sort | grep -Pv '[\x61-\x7a\x41-\x5a0-9[:punct:][:space:]]' | uniq -c
  23. for letter in $(cat agency.txt routes.txt stops.txt | grep -o . | sort -u | grep -Pv '[\x61-\x7a\x41-\x5a0-9[:punct:][:space:]]'); do
  24. echo "## $letter"
  25. grep -Ewo "[^ ]*$letter[^ ]*" agency.txt routes.txt stops.txt
  26. done
  27. cd - >/dev/null
  28. rm -rf /tmp/gtfs