View Single Post
Old 04-25-2008   #5 (permalink)
Keith Hill [MVP]


 
 

Re: Read a huge text file from bottom up

"Hayato Iriumi" <hiriumi@xxxxxx> wrote in message
news:0ea7b860-14ce-477b-9d2b-07f1b90afa43@xxxxxx
Quote:

> Hi, Bob.
>
Quote:

>> I've also wanted the last M liines in a file while this may not do
>> exactly
>> that for practical purposes its much faster than reading the entire file
>> just
>> to return the last 10 lines.
>
> I guess it depends on what kind of text file you have. I personally
> think it's safer to return certain number of bytes rather than number
> of lines because the text file could be an XML file that has only one
> line. In that case, you would be reading the entire file.
>
> I was thinking... Maybe I could make this a custom Cmdlet. Hmm... but
> it may be worth it because you can accomplish this in such a small
> amount of effort accessing .NET Framework. I hope PowerShell team will
> include this kind of Cmdlet in the next release.
Ideally, the team could add an "offset" parameter to Get-Content to allow
this use case. You should suggest it on http://connect.microsoft.com.

--
Keith

My System SpecsSystem Spec