Solved

Converting a *.txt document to a comma delimited file

Posted on 2011-09-07
4
538 Views
Last Modified: 2012-05-12
Good afternoon,
    I'm currently outputting a text document using powershell select-string; however, I need to some how convert the *.txt document to a comma delmitied file.  Below is an example:

Within the *.txt document that I'm outputting its looks like the following:

Sample1=Sample1
Sample2=Sample2


Sample3=Sample3
Sample4=Sample4

It does include 2 returns in between each section.  I would like to take this data and create a csv file that is comma delimited.  
0
Comment
Question by:wnbtechnology
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Bryan Butler
ID: 36497127
Can you give an example of the results you want?  Something like this?

Sample1,Sample1
Sample2,Sample2
Sample3,Sample3
Sample4,Sample4

0
 

Expert Comment

by:rab59718
ID: 36497495
I would import it to Excel and then save as CSV
0
 

Author Comment

by:wnbtechnology
ID: 36497583
developedtester, you are correct that is the type of result that I would like to ouput to a comma delimitied file.
0
 
LVL 16

Accepted Solution

by:
Bryan Butler earned 125 total points
ID: 36497952
gc c:\FileWithEmptyLines.txt | where {$_ -ne ""} | %{$_ -replace "=",","} > newfile.txt

0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question