I've got a text file like this:
N1 G17 G90
N3 G54
N5 S3000
N7 M03
N9 F2000
N11 G01 X0 Y0
N13 G01 X0 Y100
N15 G01 X100 Y100
N17 G01 X50 Y50
N19 G01 X30 Y30
N21 M05
N23 M30
i need a batch file where i can add a specific number to evry numer aftehr X or Y so if i add the number 200 to X and 100 to Y this would be the file
N1 G17 G90
N3 G54
N5 S3000
N7 M03
N9 F2000
N11 G01 X200 Y100
N13 G01 X200 Y200
N15 G01 X300 Y200
N17 G01 X250 Y150
N19 G01 X230 Y130
N21 M05
N23 M30
i can't seem to find any information about how to do that(i probably searching wrong or so..)
what if i got more tokens in my text? like this N1 G17 G90
N3 G54
N5 S24000
N7 M03
N9 G00 X2675.766 Y427.409 Z730
N11 G00 X2675.766 Y427.409 Z730
N13 G00 X2675.766 Y427.409 Z730
N15 G00 X2675.766 Y427.409 Z505
N17 F4000
N19 G01 X2675.766 Y427.409 Z447.5
N21 F4000
N23 G01 X2565.966 Y475.823 Z447.5
N25 F4000
N27 G02 X1852.832 Y871.38 Z447.5 I4373.42 J4575.032
N29 G03 X705.065 Y871.38 Z447.5 I1278.948 J28.138
N31 G02 X-8.069 Y475.823 Z447.5 I-1815.523 J4575.032
N33 M05
N35 M30
i tried it like this but that dident work
@echo off
setlocal EnableDelayedExpansion
(for /F "tokens=1-7" %%a in (fr17149.nc) do (
if "%%d" equ "" (
echo %%a %%b %%c
) else (
for /F "tokens=1,2 delims=XY " %%C in ("%%c %%d") do set /A X=%%C+200, Y=%%D+100
echo %%a %%b X!X! Y!Y! %%e %%f %%g
)
)) > output.txt