Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Removing crlf characters

$
0
0

I have a script to pull data from Active Directory. The attribute field called streetaddress will possibly contain multiline data like:

Address1

Address2

Address3

 

I want to remove the crlf characters and end up with

Address1 Address2 Address3. I can do this in .NET very easily but not in powershell.

I tried using $tempaddress.replace(char[10],"") or $tempaddress.replace(char(10),"", etc but it throws exceptions.

In .net I used

Dim st2 As String = Replace(st, Chr(10), "")
st2 = Replace(st2, Chr(13), " ")

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles