How to delete first for lines in a txt file

October 21, 2009 at 02:35:29
Specs: Windows 2000, 532
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 .csv

Thanks.

Note: Subject is How to delete the first four lines in a text file.


See More: How to delete first for lines in a txt file

Report •


#1
October 21, 2009 at 03:53:45
@echo off > newfile & setLocal enableDELAYedexpansion

for /f "tokens=* skip=4 delims= " %%a in (myfile) do (
>> newfile echo %%a
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
October 21, 2009 at 03:56:33
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"


Report •

Related Solutions


Ask Question