Dasel
v2
v2
  • Introduction
  • GitHub
  • Supported file formats
  • Memory usage
  • Installation
  • Commands
    • Select
    • Put
    • Delete
  • Functions
    • Selector Overview
    • All
    • And
    • Append
    • Count
    • Equal
    • Filter
    • FilterOr
    • First
    • Index
    • Join
    • Key
    • Keys
    • Last
    • Len
    • LessThan
    • MapOf
    • Merge
    • MoreThan
    • Not
    • Or
    • OrDefault
    • Parent
    • Property
    • String
    • Null
    • This
    • Type
  • Examples
    • Using dasel as a go package
    • Basics
    • Change file format
    • Filtering objects based on present/missing key
Powered by GitBook
On this page
  • Arguments
  • Examples
  • Join with no additional arguments
  • Join with arguments
Edit on GitHub
  1. Functions

Join

PreviousIndexNextKey

Last updated 1 year ago

Join allows you to join multiple values into a single string. This is dasels version of concatenation.

Expects 1 or more arguments.

Arguments

The first argument is required, and is the separator used when joining the strings.

Any further arguments are optional.

If no additional arguments are given, join uses the output of the previous function as it's input and will join those values.

If additional arguments are given, join uses those values as selectors and joins the result of those selectors.

If you wish to join data with plain strings you may use the function.

Be aware that the separator must always be a plain string and cannot contain any selector functions.

Examples

Join with no additional arguments

$ echo '{
  "name": {
    "first":"Tom",
    "last":"Wright"
  }
}' | dasel -r json 'name.all().join( )' 
"Tom Wright"

Join with arguments

$ echo '{
  "name": {
    "first":"Tom",
    "last":"Wright"
  }
}' | dasel -r json 'name.join( ,string(Hello\\, my name is ),first,last)' 
"Hello, my name is  Tom Wright"
string