{"id":5551,"date":"2015-06-14T11:59:00","date_gmt":"2015-06-14T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/06\/14\/powertip-use-powershell-to-parse-delimiters-in-file\/"},"modified":"2019-02-18T09:47:26","modified_gmt":"2019-02-18T16:47:26","slug":"powertip-use-powershell-to-parse-delimiters-in-file","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-use-powershell-to-parse-delimiters-in-file\/","title":{"rendered":"PowerTip: Use PowerShell to Parse Delimiters in File"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary<\/b><span style=\"font-size:12px\">: Use Windows PowerShell to parse file delimiters in a file.<\/span>\n<img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\">&nbsp;How can I use Windows PowerShell to break out lines in a text file that are delimited by &ldquo;\\&rdquo;? Here is the file content:<\/p>\n<p style=\"margin-left:120px\">PS C:&gt; Get-Content C:fsoAnEmptyFile.txt<\/p>\n<p style=\"margin-left:120px\">This is content<\/p>\n<p style=\"margin-left:120px\">\\mydata\\more stuff<\/p>\n<p style=\"margin-left:120px\">\\addmydata\\addmore stuff\\evenmore<\/p>\n<p style=\"margin-left:30px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\">&nbsp;Use the&nbsp;<b>&ndash;Delimiter<\/b>&nbsp;parameter of the&nbsp;<b>Get-Content<\/b>&nbsp;cmdlet. Here is an example with the associated output:<\/p>\n<p style=\"margin-left:120px\">PS C:&gt; Get-Content C:fsoAnEmptyFile.txt -Delimiter \\<\/p>\n<p style=\"margin-left:120px\">This is content<\/p>\n<p style=\"margin-left:120px\">\\<\/p>\n<p style=\"margin-left:120px\">mydata\\<\/p>\n<p style=\"margin-left:120px\">more stuff<\/p>\n<p style=\"margin-left:120px\">\\<\/p>\n<p style=\"margin-left:120px\">addmydata\\<\/p>\n<p style=\"margin-left:120px\">addmore stuff\\<\/p>\n<p style=\"margin-left:120px\">evenmore<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to parse file delimiters in a file. &nbsp;How can I use Windows PowerShell to break out lines in a text file that are delimited by &ldquo;\\&rdquo;? Here is the file content: PS C:&gt; Get-Content C:fsoAnEmptyFile.txt This is content \\mydata\\more stuff \\addmydata\\addmore stuff\\evenmore &nbsp;Use the&nbsp;&ndash;Delimiter&nbsp;parameter of the&nbsp;Get-Content&nbsp;cmdlet. Here is an example with [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[356,3,45],"class_list":["post-5551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to parse file delimiters in a file. &nbsp;How can I use Windows PowerShell to break out lines in a text file that are delimited by &ldquo;\\&rdquo;? Here is the file content: PS C:&gt; Get-Content C:fsoAnEmptyFile.txt This is content \\mydata\\more stuff \\addmydata\\addmore stuff\\evenmore &nbsp;Use the&nbsp;&ndash;Delimiter&nbsp;parameter of the&nbsp;Get-Content&nbsp;cmdlet. Here is an example with [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=5551"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5551\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=5551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=5551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=5551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}