Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Use PowerShell to Parse Delimiters in File

$
0
0

Summary: Use Windows PowerShell to parse file delimiters in a file.

Hey, Scripting Guy! Question How can I use Windows PowerShell to break out lines in a text file that are delimited by “\\”? Here is the file content:

PS C:\> Get-Content C:\fso\AnEmptyFile.txt

This is content

\\mydata\\more stuff

\\addmydata\\addmore stuff\\evenmore

Hey, Scripting Guy! Answer Use the –Delimiter parameter of the Get-Content cmdlet. Here is an example with the associated output:

PS C:\> Get-Content C:\fso\AnEmptyFile.txt -Delimiter \\

This is content

\\

mydata\\

more stuff

\\

addmydata\\

addmore stuff\\

evenmore


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>