Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have an sql which prompts user to enter datefrom and dateto. I then spool the result in a txt file, add a header then spool to a .csv file. However, the first 4 lines (containing the following:Enter value for datefrom: 01-OCT-2009
Enter value for dateto: 10-OCT-2009
old 13: AND A.created BETWEEN '&&DateFrom' and '&&DateTo'
new 13: AND A.created BETWEEN '01-OCT-2009' and '10-OCT-2009') is displayed in the .csv which distorts the report.
Please let me know how i can delete this lines before spooling in the .csvThanks.
Note: Subject is How to delete the first four lines in a text file.

@echo off > newfile & setLocal enableDELAYedexpansion
for /f "tokens=* skip=4 delims= " %%a in (myfile) do (
>> newfile echo %%a
)
=====================================
Helping others achieve escape felicityM2

Create your .csv file then streap away the first four lines so
@echo off > "Your_File.new" for /F "skip=4 delims=" %%j in ('type "Your_File.csv"') do echo.%%j>> "Your_File.new" del "Your_File.csv" ren "Your_File.new" "Your_File.csv"

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |