none
copy lines from large text file for input RRS feed

  • Question

  • hello.  thanks for the time.

    i have a large txt file in the sense of having over 10k rows. what i need to do is break it up into multiple files with every 1000 lines.

    right now i have this code:

    this gets a total of 1000.  the next thing is do the next 1000.. 

    Get-Content -totalcount 1000 -path "C:\files\list.txt" > "C:\files\batch1.txt 

    I tried this but gave me no results.

    Get-Content -totalcount 1000 -path c:\files\list.txt | select-object -skip 1000

    and tried it as where the totalcount was 2000 thinking it would skip the first 1000 . no go.

    Get-Content -totalcount 2000 -path c:\files\list.txt | select-object -skip 1000


    any suggestions?  thanks.

    Monday, February 22, 2016 8:49 PM

Answers

  • $lines=Get-content bigflie

    $lines[0..999]
    $lines[1000..1999]

    etc.


    \_(ツ)_/

    • Marked as answer by goof1427 Monday, February 22, 2016 10:02 PM
    Monday, February 22, 2016 8:55 PM
    Moderator

All replies