February 18th, 2014, 11:40 AM
Keep top 5 lines from a file and the same file name
Here is what I want to do...
I have a bunch of text files that I need to go through and keep only the top 5 lines. I need the file name to be the same as it was earlier.
Ex.: file.name - take top 5 lines (delete everything below line 5), then save file as file.name. There are a number of files that this will need to be done on as a batch.
I know this can be done in linux, but I only have windows available, but it does have perl, yet I am not a perl guy... at all.
Any help would be appreciated.
February 18th, 2014, 06:48 PM
Cygwin gives you a Linux environment on a Windows platform...
But, surely enough, it can be done in Perl and I could do it in a few lines of code. However this forum is not a place for people to get free code without making any effort. Show what you tried, and we will help you on the difficulties you are encountering. We will be glad to help you. But don't ask us to to your work (or home work) for you.