::-----bo Batchl....
@echo off & setlocal
@echo off & setlocal
Set FirstLine=True
:: Delete the existing file so that it can be created with latest data
IF EXIST ggg.txt (del /Q ggg.txt)
IF EXIST ggg.txt (del /Q ggg.txt)
For /F "tokens=*" %%i in ('findstr /V "Text in last line" "InputFile.txt"') do call :doSomething "%%i"
goto :eof
goto :eof
:: This function will check if it is the first line to be printed or it will print new line before printing next line
:doSomething
Set ThisLine="%~1"
IF %FirstLine%==True (
Set FirstLine=False
) ELSE (
echo. >> OutputFile.txt
)
call :printLine %ThisLine%
goto :eof
Set FirstLine=False
) ELSE (
echo. >> OutputFile.txt
)
call :printLine %ThisLine%
goto :eof
:: This function prints a text without next line
:printLine
for %%a in ("%~1") do (
echo/|set /p =%%a
) >> OutputFile.txt
:printLine
for %%a in ("%~1") do (
echo/|set /p =%%a
) >> OutputFile.txt
:eof
::-----eo Batch....
::-----eo Batch....