📄
Dasel
v1
v1
  • Introduction
  • Installation
    • Update
  • Use as a go package
  • Github
  • Playground
  • Usage
    • Select
    • Put
    • Put object
    • Put document
    • Delete
    • Validate
    • Flags
      • Escape HTML
      • Format
      • Multiple
      • Null
      • Merge Input Documents
    • Supported file types
  • Selectors
    • Introduction
    • Property
    • Keys and indexes
    • Index
    • Next Available Index
    • All indexes
    • Dynamic
    • Search
    • Search Optional
    • Length
    • Type
  • Notes
    • File formatting and ordering
    • Memory usage
    • Converting between formats
  • Examples
    • JQ to Dasel
    • YQ to Dasel
    • XML
    • Filter JSON API results
Powered by GitBook
On this page
  • Description
  • Usage
  • Example
  • Delete property
Edit on GitHub
  1. Usage

Delete

Description

This command allows you to delete data at a given selector.

If the root node is deleted, an empty node of the same type will be output.

Note that if your root node is anything other than an object or array, dasel will output an empty object.

Available since v1.16.0.

Usage

dasel delete -f <file> <selector>

If --file is used without --out then the source file will be updated.

Flag
Description

-f, --file

Specify the file to query. This is required unless you are piping in data.

If piping in data you can optionally pass -f stdin/-f -.

-o, --out

Specify the output file. If present, results will be written to the given file. If not present, results will be written to the input file (or stdout if none given).

To force output to be written to stdout, pass -o stdoutor-o -.

-r, --read

Specify the parser to use when reading the input data.

This is required if you are piping in data, otherwise dasel will use the given file extension to guess which parser to use.

-w, --write

Specify the parser to use when writing the output data.

If not provided dasel will attempt to use the --out and --read flags to determine which parser to use.

-p, --parser

Shorthand for -r <value> -w <value>

-m, --multiple

Tells dasel to delete multiple items.

-s, --selector, <selector>

If no selector flag is given, dasel assumes the first argument given is the selector.

This is required.

--plain

By default, dasel formats the output using the specified parser.

If this flag is used no formatting occurs and the results output as a string.

-c, --compact

This tells dasel to output compact data where possible. E.g. not pretty printing JSON.

--merge-input-documents

--escape-html

Example

Delete property

$ echo '{
  "name": "Tom",
  "email": "contact@tomwright.me"
}' | dasel delete -p json '.email'
{
  "name": "Tom"
}
PreviousPut documentNextValidate

Last updated 2 years ago

See .

See .

See .

Specify the selector to use. See for more information.

See .

See .

supported file types
supported file types
multiple
selectors
merge input documents
escape html