windows - Perpend X Number of Lines in a File with PowerShell -


i'm stuck on problem i'm working on text file. file flat text file dates have been added, in other words simple log file. problem "i need comment out number of lines, number passed param". part i'm hung on actual commenting out x number of lines part (lets # added). can read , write files, read lines , write lines search string can't seem figure out how edit x number of lines , leave other lines alone.

ps in actuality doesn't matter if lines @ end of file or beginning, though nice understand method on how add beginning or end

gc .\foo.txt | select -first 3 | %{ "#{0}" -f $_ } gc .\foo.txt | select -skip 3 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -