# 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:** 1
**Showing post:** 2

<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.

---

_[View the full topic](https://www.finalbuilder.com/forums/t/logging-cmd-output-to-variable-includes-linefeed-newline/6490)._
