CUT command for PowerShell? Extract column from 2GB fixed width text file

Share
Viewing 3 reply threads
  • Author
    Posts
    • #1554500
      Guus
      Participant
      Post count: 1
      Member Points: 81
      Rank: Level 1

      Hi, Im relatively new to PowerShell but I have worked with Unix shell scripts for 10 years.

      2 questions:

      I have a 2GB text file with more than 23,000,000 lines. Is PowerShell able to handle such files?

      Second, I need column 18 thru 24 from this file. The file has a fixed width format.

      Without a doubt this can be done using PowerShell. Just don’t know how.

      Thx for your time,

      Regards, Guus

       

      0
    • #1554526
      David Figueroa
      Participant
      Post count: 12
      Member Points: 2,432
      Rank: Level 3

      You can do it with a simple substring command.

      Most of this is really straightforward..

      We could add all kinds of things around it, like a progress bar, etc..

      David F.

      0
    • #1554542
      Guus
      Participant
      Post count: 1
      Member Points: 81
      Rank: Level 1

      Thanks David,

      This is what i made based on several findings here and there.

      It takes quite a while to finish.

      I will try your solution next and now you mention it, how can i add a progress bar to it?

      Thanks,

      Guus

      • This reply was modified 1 month, 1 week ago by Guus.
      0
    • #1554578
      David Figueroa
      Participant
      Post count: 12
      Member Points: 2,432
      Rank: Level 3

      There very well may be faster ways to get this done..  but the progress bar is relatively easy.

      The primary question is if you know roughly how many lines you have, or if you want to have a repeating progress bar.

      This will obviously slow the process down.  I set it at 1000 line interval as just a random number.. maybe you want 10000, etc.  If you have the real number of lines, you can use that to calculate your PercentComplete.

      David F.

      0
Viewing 3 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account