Skip to main content
Version: v1.16.0

join

Function

join concatenate array of strings with a separator

Synopsis

join(val: [string], sep: string) -> string

Description

The join function concatenates the elements of string array val to create a single string. The string sep is placed between each value in the resulting string.

Example:

Join a symbol array of strings:

echo '["a","b","c"]' | zq -z 'yield join(this, ",")' -

=>

"a,b,c"

Join non-string arrays by first casting:

echo '[1,2,3] [10.0.0.1,10.0.0.2]' | zq -z 'yield join(cast(this, <[string]>), "...")' -

=>

"1...2...3"
"10.0.0.1...10.0.0.2"