Re: [msh]get-content of large files.



Try replacing your foreach line with this:

get-content $filename | foreach {$_}

--
Nigel Sharples [MSFT]
Monad Test
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

"Dung K Hoang" <dunghoangkhac@xxxxxxxxxxx> wrote in message
news:%23S$pmTyPGHA.5044@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for your prompt answer!

My code is quite simple. The script looks like:

param ( $filename = (read-host "Filename pls"))
foreach ( $line in get-content $filename -readcount 1) # Try with
readcount
{
$line
}

Here is my environment:

Windows XP SP2 - Monad Beta 3.0 - Locale US
Windows server 2003 SP1 x64 - Monad Beta 3.1 - Locale US

My script is reading Exchange Messages tracking logs, IIS 6 log and ISA
server 2004 log files.. The average size is 40 MB
The log files are text files in ASCII format and use the W3C standard
format

/Dung



"Jeff Jones [MSFT]" <jeffjon@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:eooNR6xPGHA.4220@xxxxxxxxxxxxxxxxxxxxxxx
Try specifying the -ReadCount parameter with a value of -1.

MSH > get-content largefile.txt -readcount -1


--
Jeff Jones [MSFT]
Monad Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no
rights.



"Dung K Hoang" <dunghoangkhac@xxxxxxxxxxx> wrote in message
news:uXqIqvwPGHA.764@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I notice that when you use the cmdlet get-content on large files, it
takes some times before seeing output on the console.
I also observe that during the excution of the command, the virtual
memoery used by the process msh.exe can augment up to 300% and this
virtual memory is not released afterwards.
My question is: Is it a normal behavior? Any suggestion to use a
different cmdlet?

Thanks
/Dung








.



Relevant Pages

  • Re: [MSH] Script parameter without a value
    ... Microsoft Corporation ... This posting is provided "AS IS" with no warranties, ... param ...
    (microsoft.public.windows.server.scripting)
  • Re: Why disappear Database menu option?
    ... Mark Nelson ... Microsoft Corporation ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.visio.general)
  • Re: line spacing
    ... Mark Nelson ... Microsoft Corporation ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.visio.general)
  • Re: Fact Editor in Visio 2003 Pro
    ... Mark Nelson ... Microsoft Corporation ... This posting is provided "AS IS" with no warranties, ...
    (microsoft.public.visio)
  • Re: strange folder
    ... Posting any attachments is a good way to get ignored. ... Copy HJT to it's own folder, this is where the log files will be saved. ... quick start here on how to create a log file that can be copied/pasted into a forum ...
    (microsoft.public.windowsxp.general)