SOLVED

Carriage return is working properly in powershell

Brass Contributor

Hello,

 

How to parse this string properly in powershell. Replace("\r\n","`r`n") is not working properly. 

 

"\r\n  ___                      ______ _            _ _\r\n / _ \\                     | ___ (_)          | (_)\r\n/ /_\\ \\_____   _ _ __ ___  | |_/ /_ _ __   ___| |_ _ __   ___  ___\r\n|  _  |_  / | | | '__/ _ \\ |  __/| | '_ \\ / _ \\ | | '_ \\ / _ \\/ __|\r\n| | | |/ /| |_| | | |  __/ | |   | | |_) |  __/ | | | | |  __/\\__ \\\r\n\\_| |_/___|\\__,_|_|  \\___| \\_|   |_| .__/ \\___|_|_|_| |_|\\___||___/\r\n                                   | |\r\n        agent 3.10          |_|          (commit 3.20)\r\n"

1 Reply
best response confirmed by tanulbhasin (Brass Contributor)
Solution

Any of them is working:

 

  1. $a.Replace('\r\n', "`r`n").Replace('\\','\')
  2. """$a"""|ConvertFrom-Json
1 best response

Accepted Solutions
best response confirmed by tanulbhasin (Brass Contributor)
Solution

Any of them is working:

 

  1. $a.Replace('\r\n', "`r`n").Replace('\\','\')
  2. """$a"""|ConvertFrom-Json

View solution in original post