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

Creating CSV output from non CSV input

$
0
0

Hello

Can someone please help me with the following question

If I have a single text file on disk  let call it C:\temp\MyFile.txt

the text file contains : separate data as follows

 

Name   : Fred
DOB     : 1/June/1970
Hobby  : Computers

 

Name   : Jane
DOB     : 3/July/1978
Hobby  : Reading

 

etc...

there are a couple of blank lines between each set of records as shown above (so you know where one set ends and another starts)

I want to covert the above to CSV (or PowerShell object I can then export the CSV) where the text before the : becomes the key (heading) and the itext after the : becomes the value

Name     DOB                Hobby
Fred       1/June/1970   Computers
Jane       3/July/1978    Reading

 

Thanks in advance

AAnotherUser__ 

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles