Print multi-line output

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Chris Charette Chris Charette 3 years ago.

  • Author
    Posts
  • #14103
    Profile photo of Chris Charette
    Chris Charette
    Participant

    I am reading data from an SQL table and one of the fields, being a note field, has data on two or more lines. I'd like to maintain that multi-line format in my output so that the result is similar to what's below.

    [b]UserID[/b] : jdandy
    [b]FirstName[/b] : Jim
    [b]LastName[/b] : Dandy
    [b]Notes[/b] : MMN: Smith
    COB: Athens

    What I'm getting instead is:

    [b]UserID[/b] : jdandy
    [b]FirstName[/b] : Jim
    [b]LastName[/b] : Dandy
    [b]Notes[/b] : MMN: Smith COB: Athens

    Is there some way to format the output string to maintain the multi-line notes?

  • #14104
    Profile photo of Don Jones
    Don Jones
    Keymaster

    It's probably a difference in the carriage return character being used in the database vs. what PowerShell uses. Can you look and see if there's an actual CR and LF in the data?

  • #14110
    Profile photo of Chris Charette
    Chris Charette
    Participant

    That was it exactly, thanks. I also needed to find a method of keeping the array intact when I edited this data and this I was able to do using an array.

    Cool stuff, this PowerShell

You must be logged in to reply to this topic.