Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Converting a *.txt document to a comma delimited file

Posted on 2011-09-07
4
Medium Priority
?
546 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 500 total points
ID: 36497952
gc c:\FileWithEmptyLines.txt | where {$_ -ne ""} | %{$_ -replace "=",","} > newfile.txt

0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

604 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