Skip to content

delete

gapline delete <target> -w QUERY [-f PATH] [--confirm] [-o PATH]

delete removes every record matching --where from the target file. The filter is mandatory — there is no way to wipe a file with a bare gapline delete stops, by design.

When the target has dependents (for example, removing a stop_id that is referenced by stop_times.txt), gapline automatically builds a cascade plan and lists every file that will lose rows before anything is applied. There is no --cascade flag on delete: the cascade is computed from the feed’s foreign-key graph, and the confirmation prompt prints the full breakdown.

--confirm skips the interactive prompt and applies the cascade plan unconditionally. Use it only in scripts where you have already verified the match set with gapline read.

ArgumentValues
<target>Any GTFS file supported for CRUD — see read for the complete list of 17 values.
FlagShortValueDescription
--feed-fPATHPath to the GTFS feed. Optional when [default] feed is set in a config file.
--where-wQUERYRequired. Filter expression selecting the records to delete. See the query language.
--confirmSkip the interactive confirmation prompt, including the cascade preview.
--output-oPATHWrite the modified feed to this path instead of overwriting the source.

Global flags are listed on reference/global-flags.

Remove one stop and everything that references it

Section titled “Remove one stop and everything that references it”
Terminal window
gapline delete stops -f gtfs.zip --where "stop_id=S01"

The prompt lists every dependent row (stop_times, transfers, pathways, …) that will be removed before asking for confirmation.

Terminal window
gapline delete trips -f gtfs.zip --where "route_id=OLD_LINE" --confirm

Related rows in stop_times.txt and frequencies.txt are cascaded automatically.

Terminal window
gapline delete calendar-dates -f gtfs.zip --where "date<20240101" --confirm

calendar-dates is a leaf file (nothing references it), so there is no cascade.

Write to a new feed instead of overwriting

Section titled “Write to a new feed instead of overwriting”
Terminal window
gapline delete stops -f gtfs.zip --where "stop_id=S01" --confirm -o gtfs-cleaned.zip
CodeMeaning
0Records deleted successfully, or the user declined the prompt.
1--where could not be parsed.
2Configuration error.
3I/O error (feed not found, output path unwritable).
4--where matched zero records. Nothing was written.

See concepts/exit-codes for the complete table.