Trim Whitespace for Multiple Line Variable Value


The Trim Whitespace option in the Filter action removes leading and trailing whitespace from a string. Is there a way to remove leading and trailing whitespaces for every line from a variable value?

Z-Test.kmmacros (2.8 KB)


Hi @ChrisQ. Yes there is; check out this thread: MACRO: Text Transformation EXAMPLES

1 Like

Hi @_jims,

Wow, you've already created a macro for this and MORE! Wish I had seen this earlier because I could have used some of the other text transformations like extracting the domain of the url excluding .com etc.

I will download and check out the macro. Thanks again, greatly appreciate the super quick response. :slight_smile:

1 Like

Hi @ChrisQ. I've been working to improve my Bash skills. Your question prompted me to add two new examples.

  • EX 30: Remove leading/trailing whitespace on lines + convert whitespace-only lines to newlines [shell-native Bash]
  • EX 31: Remove leading/trailing whitespace on lines + whitespace-only lines [shell-native Bash]
1 Like