diff --git a/prog/gtfs_make_shape_by_id.py b/prog/gtfs_make_shape_by_id.py
new file mode 100755
index 0000000000000000000000000000000000000000..440ea43e09faaa5fcbcec066c0a9be2564001634
--- /dev/null
+++ b/prog/gtfs_make_shape_by_id.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env pypy3
+
+import sys, os, shutil
+import tempfile
+from pathlib import Path
+
+path = Path(sys.argv[1])
+
+tmp_dir = tempfile.mkdtemp(dir="tmp")
+print(tmp_dir)
+
+with open(path/"shapes.txt") as inf:
+    assert inf.readline().strip() == 'shape_id,shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled'
+    outf = None
+    last_shape_id = None
+    while True:
+        try:
+            l = inf.readline().strip()
+        except EOFError:
+            break
+        if l == '':
+            break
+        shape_id, rest = l.split(",", 1)
+        if last_shape_id == None or shape_id != last_shape_id:
+            if outf: outf.close()
+            outf = open(Path(tmp_dir)/shape_id, 'x')
+            outf.write('shape_pt_lat,shape_pt_lon,shape_pt_sequence,shape_dist_traveled\n')
+        outf.write(rest+'\n')
+        last_shape_id = shape_id
+
+    if outf: outf.close()
+
+if Path(path/'shape_by_id').is_dir():
+    shutil.rmtree(path/'shape_by_id')
+os.rename(tmp_dir, path/'shape_by_id')
+
+
+