Put

Description

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

Dasel will create any data items that do not already exist allowing you to create entire data structures from nothing.

Usage

dasel put <type> -f <file> <selector> <value>

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

Example

Put string

$ echo "name: Tom" | ./dasel put string -p yaml ".name" Jim
name: Jim

Create documents from scratch

You can pipe multiple dasel commands together in order to build entire documents or make multiple changes:

$ echo '' |
dasel put string -p yaml '.servers.[].bind_dn' 'x' |
dasel put string -p yaml -m '.servers.[*].attributes.name' 'y' |
dasel put string -p yaml -m '.servers.[*].group_mappings.[].group_dn' 'a' |
dasel put string -p yaml -m '.servers.[*].group_mappings.[].group_dn' 'b'
servers:
  - attributes:
      name: "y"
    bind_dn: x
    group_mappings:
      - group_dn: a
      - group_dn: b

Last updated