views:

64

answers:

4

What's the best method to delete the first line of text from a large (10k+) group of text files.

A: 

If using PowerShell is an option you could adopt from this post: http://stackoverflow.com/questions/2074271/remove-top-line-of-text-file-with-powershell

Filburt
A: 

If you can install TAIL in your sistem

tail -n +2 filename > finalfilename

shows all the filename except the first line.

The windows CMD, in my opinion, isn't the best "terminal". However, you don't need tail command. As Patrick Cuff said, you cand use the more command that does basically the same.

I think that is the best answer to do with buil-in commands.

If you know a bit about programming, you can make a small program that does what you want and call it in a bat file.

Also, you can use other windows terminals like cygwin, powershell or console that have more flexible built in commands to do this kind of stuff.

Marco
Installing via cygwin would gain you many such tools. for i in files ; do tail -n +2 $i > $i_noheader ; done
James Broadhead
Yeah, but the answer of Patric Cuff is basically the same and is built-in in windows :P. And If you want to install some new shell, I think some people prefer installing PowerShell or Console instead of Cygwin
Marco
+1  A: 

If PowerShell isn't an option, you can use the more command:

more [file] +2 > [new file]

Stick that in a for loop that also then renames [new file] to [file] and you'll have the file minus the first line.

Not pretty, but should work.

Patrick Cuff
A: 

download sed for windows. Then do this

c:\test> sed -i.bak "1d" file

use a for loop to iterate files

ghostdog74