get-content parameters question - I want to ignore the first three lines of a text file, output the text file to another...
i have question smart people;
i have need manipulate a text file. nothing i've seen in (get-help) get-content seems answer question have; know it's simple syntax wise don't know how pose interpreter.
i want take text file, read in, write out after deleting first 3 lines (up , including carriage return character..
example:
--file begin--
blah blah blah
this not important
another bunch of junk
the real data....
--file end--
so output file should read:
--file begin--
the real data....
--file end--
from powershell, think preliminarily command read:
get-content filename.txt {unknown parameters}| set-content outfile.txt
i see through get-help can grab first nn lines -totalcount parameter. see can grab first nn lines combining -totalcount parameter in command parantheses , outside of parantheses [-1] grab last line of nn specified.
i see there's exclude parameter not seeing how use command ignore first nn lines , output. has drop dead simple i'm not finding section.
:(
oook got it.. everyone's use, here's command....
(get-content 2.txt|where {$_.readcount -lt 1 -or $_.readcount -gt 3})|set-content outfile.txt
where 2.txt input file 3 lines of garbage @ top, , outfile.txt stuff want.
thanks reading!
Windows Server > Windows PowerShell
Comments
Post a Comment