Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - removing first three lines in a text file

Reply
 
Old 11-17-2006   #1 (permalink)
fixitchris


 
 

removing first three lines in a text file

I have a 10mb text file and instead of doing get-contents set-contents i
would like to just remove the first 3 lines of the text file. Is there a way
to do this quickly?

Chris

My System SpecsSystem Spec
Old 11-17-2006   #2 (permalink)
Flowering Weeds


 
 

Re: removing first three lines in a text file


>I have a 10mb text file and instead
> of doing get-contents set-contents i
> would like to just remove the first 3
> lines of the text file. Is there a way
> to do this quickly?
>


Perhaps Microsoft's Log Parser
http://www.microsoft.com/technet/scr...r/default.mspx


My System SpecsSystem Spec
Old 11-17-2006   #3 (permalink)
Alex K. Angelopoulos [MVP]


 
 

Re: removing first three lines in a text file

If you mean quickly in terms of CPU cycles, there is nothing that works with
files in a classical text-based sense that will do that. Generally every
single utility that does some kind of tailing operation has to go through
the entire file.

If your concern is resource loading, your best bet is to write to a new file
line-by-line after skipping 3 lines, then delete the old file and rename the
new one.

"fixitchris" <fixitchris@discussions.microsoft.com> wrote in message
news:8DFE1628-3635-40A9-9C44-2F585BE45873@microsoft.com...
>I have a 10mb text file and instead of doing get-contents set-contents i
> would like to just remove the first 3 lines of the text file. Is there a
> way
> to do this quickly?
>
> Chris



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Using lines in a text file PowerShell
Howto: Add lines of text from a specific point in a text file.. VB Script
get the number of lines in a text file PowerShell
Removing lines from a text file PowerShell
Removing lines from a text file by matching against substrings PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46