I have create a gerber file and it has lines inside which look like this:
X90095Y15350 X100095Y15350 X110095Y15350 X120095Y15350 X120095Y25350 X110095Y25350 X100095Y25350 X90095Y25350 X80095Y25350 X160095Y25350
These are coordinates of the drill path - mind the X and Y. Number after the X and Y varies - it is sometimes a 6-digit and sometimes 5-digit.
Now I need a script which would first identify if the line starts with an X and then use sed or any other Linux tool to convert this into a format where X and Y are both 4-digits long so that line:
Can anyone help me. I am a bit too weak in regular expressions in order to solve this myself... If there is any other command which would do this it would allso be fine.
The anwser provided is working OK and I could use it to reformat my file. After uploading it into my application I noticed that we did a wrong conversion.
I am sorry for this, but now I know what needs to be done. So If a line starts with an "X" we only have to remove the last digit of numbers after X and Y. For example if I have:
X90095Y15350 X100095Y15350 X110095Y15350
I need to get the last digit of every position (X and Y) removed:
X9009Y1535 X10009Y1535 X11009Y1535
Could someone help me with this one. =/