I've fiddled a bit with wingrep but doesn't seem to support this.
H开发者_StackOverflow中文版as anyone had any luck with say deleting the first 7 lines of text from all .txt files in directory "C:\my_direc\"?
I'm using Win XP.
Here's a VBScript solution. Haven't tested it, but it should at least put you on the right track.
Dim FSO, txs, fld, fil, content, nLinesToSkip, i
Set FSO = CreateObject("Scripting.FileSystemObject")
nLinesToSkip = 7
fld = FSO.GetFolder("C:\test\")
For Each fil In fld
If Right(fil.Name, 3) = "txt" Then
Set txs = fil.OpenAsTextStream(1) ' 1 = for reading
For i = 1 To nLinesToSkip
txs.SkipLine
Next i
content = txs.ReadAll
txs.Close
Set txs = fil.OpenAsTextStream(2) ' 2 = for writing
txs.Write content
txs.Close
End If
Next fil
You can try Delete Lines tool
精彩评论