{"id":1055,"date":"2021-01-09T21:16:09","date_gmt":"2021-01-10T03:16:09","guid":{"rendered":"http:\/\/ninmonkeys.com\/blog\/?p=1055"},"modified":"2022-03-10T11:55:59","modified_gmt":"2022-03-10T17:55:59","slug":"powershell-prefixing-lines-with-the-pipe-operator","status":"publish","type":"post","link":"https:\/\/ninmonkeys.com\/blog\/2021\/01\/09\/powershell-prefixing-lines-with-the-pipe-operator\/","title":{"rendered":"PowerShell : Prefixing lines with  the Pipe operator |"},"content":{"rendered":"\n<p><a href=\"https:\/\/get-powershellblog.blogspot.com\/2017\/07\/bye-bye-backtick-natural-line.html\">There&#8217;s a lot of ways to use line continuations in <code class=\"\" data-line=\"\">Windows Powershell<\/code> without backticks<\/a> . <code class=\"\" data-line=\"\">Powershell<\/code> added a new one, the <code class=\"\" data-line=\"\">|<\/code> pipe operator. It&#8217;s cleaner to read, and makes it easier to insert, delete, or toggle comments on the console.<br><br>Now you can write:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-powershell\" data-line=\"\"># Powershell\nls | sort Length\n| Select -First 10\n| ft Name, Length<\/code><\/pre>\n\n\n\n<p>Instead of piping on line endings<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-powershell\" data-line=\"\"># Windows Powershell\nls | sort Length |\nSelect -First 10 |\nft Name, Length\n\n# or\nls | sort Length | Select -First 10 | ft Name, Length<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s cleaner to read, and makes it easier to insert, delete, or toggle comments on the console.<\/p>\n","protected":false},"author":1,"featured_media":1059,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[66,109,18,95,40,25],"tags":[30,117,4,116,22,26],"_links":{"self":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/1055"}],"collection":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/comments?post=1055"}],"version-history":[{"count":26,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/1055\/revisions"}],"predecessor-version":[{"id":1082,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/posts\/1055\/revisions\/1082"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/media\/1059"}],"wp:attachment":[{"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/media?parent=1055"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/categories?post=1055"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ninmonkeys.com\/blog\/wp-json\/wp\/v2\/tags?post=1055"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}