Reblog: Powershell – Head and Tail
Most new data sets for my scientific visualization find their way to my desk in form of arbitrarily structures text files. This is not really a problem. The first sensible step is converting them into a fast binary format for the visual analysis. With this, however, I face the problem of understanding the structure of 11 Gigabytes text files (no exaggeration here!). But, such files do have structure. So, only the few first and few last lines really matter. The bits in-between will be roughly the same way. What I need are the Linux-known commands “head” and “tail”. However, I am a Windows guy. So? The Powershell comes to the rescue:
gc log.txt | select -first 10 # head
gc log.txt | select -last 10 # tail
I found these on: http://stackoverflow.com/a/9682594 (where else)
At least the “head” version was fast and sufficient for me. I am happy.