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



Hi,

That makes the trick!
What is the rationale behind this?

As for the virtual memory issue, here is what I observe:
a) If I simply run the script, the process memory consumption does not grow.
b) When I apply the time-expression to the script, .ie. time-expression { my
script } to get the processing time, there is no output to the console, and
this is where the memory consumption increases.

Thanks for your answer,
/Dung

"Nigel Sharples [MSFT]" <nigels@xxxxxxxxxxxxx> wrote in message
news:4408ebec$1@xxxxxxxxxxxxxxxxxxxxx
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]get-content of large files.
    ... My script is reading Exchange Messages tracking logs, ... The log files are text files in ASCII format and use the W3C standard ... I notice that when you use the cmdlet get-content on large files, ... virtual memory is not released afterwards. ...
    (microsoft.public.windows.server.scripting)
  • Re: [msh]get-content of large files.
    ... As for the virtual memmory issue, in the time-expression, if I redirect the ... output of the script to $Null then everything is OK! ... As for the virtual memory issue, ... The log files are text files in ASCII format and use the W3C standard ...
    (microsoft.public.windows.server.scripting)
  • Re: WMI script to display also the virtual memory
    ... > I need the following great script by David Roth to also display the ... > virtual memory for every process - what should I change for this? ... We can help you with programming problems. ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)
  • Re: Scripting Questions
    ... have a remote domain that was just brought into our AD environment. ... about their machines, (OS, memory, virtual memory, default java machine, and ... script for more than one pc at a time. ...
    (microsoft.public.scripting.wsh)

Loading