# Logging CMD output to Variable includes linefeed/newline

**URL:** https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490
**Category:** Discussion
**Created:** [May 10, 2019, 9:25pm UTC](https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490 "2019-05-10T21:25:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![JonathanSQR](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@JonathanSQR](https://www.finalbuilder.com/forums/u/JonathanSQR)
#### Post date: [May 10, 2019, 9:25pm UTC](https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490/1 "2019-05-10T21:25:42Z")

</div>

Hi There

I am dynamically getting build parameters via a command line application I made. These values are then logged to a variable in the FB project to then be used later. I found that these logged variables (strings) were being stored with linefeeds/newlines. This then breaks various other commands that use these variables.  
I tried to do some research on this but have not found anything specifically discussing this behavior and how to stop it.  
Am I missing an option somewhere? Is there a function I can use to remove the trailing linefeeds/newlines?

Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [May 12, 2019, 11:43pm UTC](https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490/2 "2019-05-12T23:43:09Z")

</div>

The String Trimming action will remove trailing cr/lf’s if Trim Right or Trim Left/Right is selected. If you have trailing spaces you want to keep then you will need to use the Text Find/Replace action, set the search string to something like (this will remove leading and trailing line breaks).

`^[\r\n]+|\.|[\r\n]+$`

and check the “Match as regular expression” checkbox, on the Replace tab set to “Replace text and write back to variable” and leave the replacement string blank.

---

<div class="post-metadata">

### Author: ![JonathanSQR](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@JonathanSQR](https://www.finalbuilder.com/forums/u/JonathanSQR)
#### Post date: [May 13, 2019, 10:21am UTC](https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490/3 "2019-05-13T10:21:04Z")

</div>

Hi Vincent

Just tried that now and it works as required.

Thanks very much for the help.
