delete
Synopsis
Section titled “Synopsis”gapline delete <target> -w QUERY [-f PATH] [--confirm] [-o PATH]Description
Section titled “Description”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.
Arguments
Section titled “Arguments”| Argument | Values |
|---|---|
<target> | Any GTFS file supported for CRUD — see read for the complete list of 17 values. |
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 | Required. Filter expression selecting the records to delete. See the query language. |
--confirm | Skip the interactive confirmation prompt, including the cascade preview. | ||
--output | -o | PATH | Write the modified feed to this path instead of overwriting the source. |
Global flags are listed on reference/global-flags.
Examples
Section titled “Examples”Remove one stop and everything that references it
Section titled “Remove one stop and everything that references it”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.
Drop every trip on a retired route
Section titled “Drop every trip on a retired route”gapline delete trips -f gtfs.zip --where "route_id=OLD_LINE" --confirmRelated rows in stop_times.txt and frequencies.txt are cascaded automatically.
Prune expired calendar entries
Section titled “Prune expired calendar entries”gapline delete calendar-dates -f gtfs.zip --where "date<20240101" --confirmcalendar-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”gapline delete stops -f gtfs.zip --where "stop_id=S01" --confirm -o gtfs-cleaned.zipExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Records deleted successfully, or the user declined the prompt. |
1 | --where could not be parsed. |
2 | Configuration error. |
3 | I/O error (feed not found, output path unwritable). |
4 | --where matched zero records. Nothing was written. |
See concepts/exit-codes for the complete table.
See also
Section titled “See also”gapline read— preview the match set before deleting.gapline update— rewrite records rather than removing them.- Concepts / Referential integrity.
- Guides / Editing with CRUD.