read
Synopsis
Section titled “Synopsis”gapline read <target> [-f PATH] [-w QUERY] [--format FORMAT] [-o PATH]Description
Section titled “Description”read loads a GTFS feed into memory and prints records from a single file. With --where, the output is filtered by a SQL-like expression; without it, every record is returned. Nothing is ever written to disk by this command.
The result respects the canonical column order of the GTFS spec. Output formats match validate: colored text (default), JSON, CSV, XML, or HTML.
Arguments
Section titled “Arguments”| Argument | Values |
|---|---|
<target> | One of: agency, stops, routes, trips, stop-times, calendar, calendar-dates, shapes, frequencies, transfers, pathways, levels, feed-info, fare-attributes, fare-rules, translations, attributions. Underscored aliases (stop_times, calendar_dates, feed_info, fare_attributes, fare_rules) are also accepted. |
Options
Section titled “Options”| Flag | Short | Value | Description |
|---|---|---|---|
--feed | -f | PATH | Path to the GTFS feed. Optional when [default] feed is set in a config file. |
--where | -w | QUERY | Filter expression in the query language. Omit to return every record in the file. |
--format | FORMAT | Output format: text, json, csv, xml, html. Defaults to text. | |
--output | -o | PATH | Write the results to this path instead of stdout. |
Global flags are listed on reference/global-flags.
Examples
Section titled “Examples”List every stop in the feed
Section titled “List every stop in the feed”gapline read stops -f gtfs.zipFetch a single stop by ID
Section titled “Fetch a single stop by ID”gapline read stops -f gtfs.zip --where "stop_id=S01"Find stops whose name starts with Gare
Section titled “Find stops whose name starts with Gare”gapline read stops -f gtfs.zip --where "stop_name LIKE Gare%"Combined conditions
Section titled “Combined conditions”gapline read stop-times -f gtfs.zip --where "trip_id=T1 AND stop_sequence>10"AND has higher precedence than OR. Quote the expression so the shell does not split it on spaces.
Export filtered rows as CSV
Section titled “Export filtered rows as CSV”gapline read routes -f gtfs.zip --where "route_type=3" --format csv -o buses.csvAliased target names
Section titled “Aliased target names”gapline read stop_times -f gtfs.zip --where "trip_id=T1"gapline read stop-times -f gtfs.zip --where "trip_id=T1"Both kebab-case and underscore spellings resolve to the same target.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Query ran successfully (including cases where zero rows matched). |
1 | The --where expression could not be parsed. |
2 | Configuration error. |
3 | I/O error (feed not found, output path unwritable). |
See concepts/exit-codes for the complete table.
See also
Section titled “See also”- Query language — full grammar of
--where. gapline update— modify the records you found.gapline delete— remove them.- Output formats.