Archive: How to Delete Lines 1 Through 7, Then Last 3 Lines?


How to Delete Lines 1 Through 7, Then Last 3 Lines?
Can someone please offer some help on this issue. I am generating some files and within them is erroneous data that needs to be removed. Basically, the first 7 lines and last 3 lines need to be erased from the file.

Any help is greatly appreciated!


Name "Output"
OutFile "Output.exe"

!include "TextFunc.nsh"
!insertmacro LineFind

Section
${LineFind} "C:\input.txt" "C:\output.txt" "1:7 -3:-1" "LineFindCallback"

IfErrors 0 +2
MessageBox MB_OK "Error"
SectionEnd

Function LineFindCallback
StrCpy $0 SkipWrite

Push $0
FunctionEnd


Script used header

You could simplify the LineFindCallback a little if you like...

Function LineFindCallback
Push SkipWrite
FunctionEnd

-Stu


This is great! Thanks Afrow and thanks Instructor!