<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PowerShell Get Content</title>
	<atom:link href="http://jdhitsolutions.com/blog/2007/02/powershell-get-content/feed/" rel="self" type="application/rss+xml" />
	<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=powershell-get-content</link>
	<description>Advice, solutions, tips and more for the lonely Windows administrator with too much to do and not enough time.</description>
	<lastBuildDate>Tue, 07 Feb 2012 16:20:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-100</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Thu, 23 Jul 2009 14:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-100</guid>
		<description>I just ran &lt;br /&gt;&lt;br /&gt;PS C:\windows&gt; (gc .\WindowsUpdate.log)[-10..-1]&lt;br /&gt;&lt;br /&gt;In PowerShell v2 on a log file with 16511 lines and it took hardly any time at all to grab the last 10 lines.</description>
		<content:encoded><![CDATA[<p>I just ran </p>
<p>PS C:\windows&gt; (gc .\WindowsUpdate.log)[-10..-1]</p>
<p>In PowerShell v2 on a log file with 16511 lines and it took hardly any time at all to grab the last 10 lines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-99</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Thu, 23 Jul 2009 14:15:40 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-99</guid>
		<description>You might wait and try using the version of Get-Content in PowerShell v2.0. Performance with large text files is always an issue.</description>
		<content:encoded><![CDATA[<p>You might wait and try using the version of Get-Content in PowerShell v2.0. Performance with large text files is always an issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-98</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 23 Jul 2009 02:55:32 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-98</guid>
		<description>I&#039;m just trying to find Linux equivalents for PS to work on our big log files on Windows and its true, the PS commands are taking about 3 minutes to get a result back which is not acceptable for me. Hope that there is another solution to read the file from the end instead of reading the whole file.&lt;br /&gt;&lt;br /&gt;Any ideas yet?&lt;br /&gt;Thanks.</description>
		<content:encoded><![CDATA[<p>I&#39;m just trying to find Linux equivalents for PS to work on our big log files on Windows and its true, the PS commands are taking about 3 minutes to get a result back which is not acceptable for me. Hope that there is another solution to read the file from the end instead of reading the whole file.</p>
<p>Any ideas yet?<br />Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-88</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 02 Mar 2009 21:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-88</guid>
		<description>Unlike tail, which I believe reads the file in reverse n number of lines, using [-n..-m] or &#124; select -last n seems to require PS to read the entire file and then just return what you&#039;ve selected.  Try using either of the proposed PS techniques to &quot;tail&quot; a 300 MB file.  It takes five minutes, compared to 5 seconds with tail.  &lt;br/&gt;&lt;br/&gt;For a tail equivalent, PS would need to filter the input, not the output.</description>
		<content:encoded><![CDATA[<p>Unlike tail, which I believe reads the file in reverse n number of lines, using [-n..-m] or | select -last n seems to require PS to read the entire file and then just return what you&#8217;ve selected.  Try using either of the proposed PS techniques to &#8220;tail&#8221; a 300 MB file.  It takes five minutes, compared to 5 seconds with tail.  </p>
<p>For a tail equivalent, PS would need to filter the input, not the output.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-30</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Fri, 16 Feb 2007 01:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-30</guid>
		<description>I must have had fumbled fingers the first time I tried your suggestion because it didn&#039;t work for me.  Maybe I missed the minus signs. But I see now what you are talking about.&lt;br/&gt;&lt;br/&gt;Thanks.</description>
		<content:encoded><![CDATA[<p>I must have had fumbled fingers the first time I tried your suggestion because it didn&#8217;t work for me.  Maybe I missed the minus signs. But I see now what you are talking about.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Canto</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-29</link>
		<dc:creator>Vinicius Canto</dc:creator>
		<pubDate>Fri, 16 Feb 2007 00:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-29</guid>
		<description>Yeah, great...&lt;br/&gt;&lt;br/&gt;But my recommendation works even when you don&#039;t know de lenght of the file. If you use an invalid interval (like use [-4000..-1] with a file with only four lines, the command still works.&lt;br/&gt;&lt;br/&gt;By curiosity, I found on the Internet  the legend, the original Tail command, but for Windows!&lt;br/&gt;http://tailforwin32.sourceforge.net/&lt;br/&gt;&lt;br/&gt;I haven&#039;t tested yet, but I liked.&lt;br/&gt;&lt;br/&gt;Congratulations for you blog... it&#039;s very good. It&#039;s in my blog list now!&lt;br/&gt;&lt;br/&gt;Vinicius</description>
		<content:encoded><![CDATA[<p>Yeah, great&#8230;</p>
<p>But my recommendation works even when you don&#8217;t know de lenght of the file. If you use an invalid interval (like use [-4000..-1] with a file with only four lines, the command still works.</p>
<p>By curiosity, I found on the Internet  the legend, the original Tail command, but for Windows!<br /><a href="http://tailforwin32.sourceforge.net/" rel="nofollow">http://tailforwin32.sourceforge.net/</a></p>
<p>I haven&#8217;t tested yet, but I liked.</p>
<p>Congratulations for you blog&#8230; it&#8217;s very good. It&#8217;s in my blog list now!</p>
<p>Vinicius</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeffery Hicks</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-28</link>
		<dc:creator>Jeffery Hicks</dc:creator>
		<pubDate>Thu, 15 Feb 2007 11:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-28</guid>
		<description>Using the alias, cat, certainly makes it easier. Just as a point of reference, I try to avoid using aliases so that people understand what cmdlet is really doing the work.&lt;br/&gt;&lt;br/&gt;Your comment certainly works if you know the length of the file.  I also should have pointed out that you can use:&lt;br/&gt;&lt;br/&gt;cat c:\boot.ini -totalcount 3&lt;br/&gt;&lt;br/&gt;and that will return the first 3 lines. -1 means return everything so you can use that to get the end of the file.  But certainly a handy HEAD subsitute.</description>
		<content:encoded><![CDATA[<p>Using the alias, cat, certainly makes it easier. Just as a point of reference, I try to avoid using aliases so that people understand what cmdlet is really doing the work.</p>
<p>Your comment certainly works if you know the length of the file.  I also should have pointed out that you can use:</p>
<p>cat c:\boot.ini -totalcount 3</p>
<p>and that will return the first 3 lines. -1 means return everything so you can use that to get the end of the file.  But certainly a handy HEAD subsitute.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vinicius Canto</title>
		<link>http://jdhitsolutions.com/blog/2007/02/powershell-get-content/#comment-27</link>
		<dc:creator>Vinicius Canto</dc:creator>
		<pubDate>Wed, 14 Feb 2007 23:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://jdhitsolutions.com/blog/2007/02/13/powershell-get-content/#comment-27</guid>
		<description>Hi,&lt;br/&gt;&lt;br/&gt;I have posted another solution (and some comments) about the last command, to show only the last 5 lines of a file...&lt;br/&gt;&lt;br/&gt;Instead of&lt;br/&gt;&lt;br/&gt;$c=get-content c:\boot.ini;$l=$c.length;$c[($l-5)..$l]&lt;br/&gt;&lt;br/&gt;you can use&lt;br/&gt;&lt;br/&gt;(cat c:\boot.ini)[-5..-1]&lt;br/&gt;&lt;br/&gt;The only problem is... my blog is in Portuguese. There are few content about Powershell and scripting in my country...&lt;br/&gt;&lt;br/&gt;If you have some time:&lt;br/&gt;http://viniciuscanto.blogspot.com/2007/02/tail-x-get-content-obtendo-as-ltimas.html&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Tks!&lt;br/&gt;&lt;br/&gt;--&lt;br/&gt;Vinicius Canto &lt; scripterbr_at_gmail_dot_com &gt;&lt;br/&gt;MVP Visual Developer - Scripting&lt;br/&gt;MCP Windows 2000 Server, Windows XP e SQL Server 2000&lt;br/&gt;Blog sobre Scripting: http://viniciuscanto.blogspot.com</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I have posted another solution (and some comments) about the last command, to show only the last 5 lines of a file&#8230;</p>
<p>Instead of</p>
<p>$c=get-content c:\boot.ini;$l=$c.length;$c[($l-5)..$l]</p>
<p>you can use</p>
<p>(cat c:\boot.ini)[-5..-1]</p>
<p>The only problem is&#8230; my blog is in Portuguese. There are few content about Powershell and scripting in my country&#8230;</p>
<p>If you have some time:<br /><a href="http://viniciuscanto.blogspot.com/2007/02/tail-x-get-content-obtendo-as-ltimas.html" rel="nofollow">http://viniciuscanto.blogspot.com/2007/02/tail-x-get-content-obtendo-as-ltimas.html</a></p>
<p>Tks!</p>
<p>&#8211;<br />Vinicius Canto < scripterbr_at_gmail_dot_com ><br />MVP Visual Developer &#8211; Scripting<br />MCP Windows 2000 Server, Windows XP e SQL Server 2000<br />Blog sobre Scripting: <a href="http://viniciuscanto.blogspot.com" rel="nofollow">http://viniciuscanto.blogspot.com</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>

