Link to home
Start Free TrialLog in
Avatar of Kiran Sonawane
Kiran SonawaneFlag for India

asked on

Batch file Remove "ECHO is off " from output file


 Batch File code



@echo off
SETLOCAL ENABLEDELAYEDEXPANSION


bcp "select 'Name', 'EIN', 'AccountId', 'Other ID', 'Address Line 1', 'Address Line 2', 'City', 'State', 'Zip Code', 'Country', 'Other Data', 'Provider ID', 'Group ID' union all select * from testdb" queryout "C:\Data\CAAGBusinessFile.txt" -c -test\T_GSS -testuser -mypass

call :StripBlankLines CAAGBusinessFile.txt


bcp testdb out "C:\Data\CAAGIndividualsFile.TXT" -c -SNTSMSQL15011A\T_GSS -tesur -Ptest




call :StripBlankLines CAAGIndividualsFile.TXT


:StripBlankLines

For %%x in (%*) do set OutF=temp_(%%~nx).txt

::del %OutF%


for /F "tokens=* delims=" %%B in (%*) do echo %%B >> %OutF%

Goto :EOF

:End

Open in new window


Output
kiran	G	Sonawane		12	1	1	Rahatani		Pune	MH	41125	IN		O	1	1 
ECHO is off
test				233												 
Prakash	S	Tike		33	2	2	Don		K		456					1 

Open in new window

Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

not sure which of the lines of code result in that line, and if nothing helps, you rework the file with another cat + find > newfile to skip that line ...
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kiran Sonawane

ASKER

@oBdA: You are champion 500+