Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a .exe which runs on windows, it reads column in a input file and gives transformed output.
Requirement: I have multiple Input files and each file has 3 columns, need to pass the 3rd column to .exe and .exe will return transformed output in form of columns in tab delimited say 5 columns. Need to append 1st and 2nd columns from input file to this output, ie, for each input file read by .exe, i need to get one output file with first 2 columns in input file + new columns generated by .exe.
I tried calling the exe from batch script, the problem here is its taking very long time to read the files and give the ouptut.
sample data in input file:
CYHD 1420071840 CYHD 010024Z AUTO 26017G22KT 3SM -SN FEW021 SCT026 BKN034 OVC041 M12/M14 A2963 RMK SLP072
batch script I used:
@echo off
set "TAB= "
set "SPACE= "
set z=0
set srcdir=C:\Users\502525968\Desktop\Source10\
set outdir=C:\Users\502525968\Desktop\Target10\
set filefilter=*.dat
rem rd /s /q %outdir%
rem mkdir %outdir%
for /r %srcdir% %%g in (%filefilter%) do (
set currfile=%%~nxg
echo processing %%~nxg
for /f "tokens=*" %%r in (%srcdir%/%%~nxg) do (
set /a z=0
call :processline %%r
)
set /a z=0
call :addcolumn
)
set "col1="
SET "col2="
SET "col3="
goto :eof
:processline
for /f "tokens=*" %%c IN ("%*") do for %%B in (%%c) do (
call :addcolumn %%B
)
exit /b
:addcolumn
set /a z+=1
if %z% == 1 (
if not "%col1%" == "" (
if not "%col2%" == "" (
MetarParser10.exe -m "%col3%" -l >> %outdir%/%currfile%
echo %col1%%TAB%%col2%>> %outdir%/%currfile%
)
)
set "col1="
set "col2="
set "col3="
)
if %z% == 1 (set "col1=%TAB%%1") else ( if %z% == 2 (set "col2=%1") else ( if %z% == 3 (set "col3=%1") else ( set "col3=%col3%%SPACE%%1" )))
exit /b
goto :eof
:eof
can we implement this in talend or is there any way to tune this.
Thanks,
Srinivas