trim

The trim command removes leading and trailing whitespace from the input field. This is useful when a field contains values that contain leading and/or trailing whitespace inconsistently and such whitespace should be ignored.

  • single input
  • single output
  • default output fieldname: “trim”
  • no arguments

Example

Remove leading and trailing whitespace from user values.

"transforms" : [
    {
        "transform" : "trim",
        "inputs" : ["user"],
        "outputs" : ["user_trimmed"]
    }
]

In this example the following input data

time,                 user,      count
2015-03-01 01:00:00Z, user_1,    5
2015-03-01 01:00:00Z, user_2,    6
2015-03-01 01:00:00Z, user_3,    3
2015-03-01 01:00:00Z, user_4,    1

would transform to look like this

time,                 user,      count, user_trimmed
2015-03-01 01:00:00Z, user_1,    5,     user_1
2015-03-01 01:00:00Z, user_2,    6,     user_2
2015-03-01 01:00:00Z, user_3,    3,     user_3
2015-03-01 01:00:00Z, user_4,    1,     user_4