My question is more of an optimization one, rather then a "howto".
I have a lef file, with thousands of lines in the form of:
RECT 429.336 273.821 426.246 274.721 ;
I wanted to move left by 4 um all rects above a certain point using a one-liner:
perl -lane '$F[2] > 1200 ? print $F[0]," ", ($F[1] - 4)," ", $F[2]," ", ($F[3] -4)," ", $F[4], " ;" : print $_' trial.lef
Thing is, this is UGLY.
Is there a nicer way of editing the file?
I'm not picky and will be happy to have answers with other languages (awk, sed, etc.) as long as they are nicer than what I wrote.
Additional input:
LAYER M12 ;
RECT 0 411.214 1 412.214 ; <-- shouldn't change, because 411.214 < 1200
END
END kuku_pin
PIN gaga_pin
DIRECTION OUTPUT ;
USE SIGNAL ;
PORT
LAYER M11 ;
RECT 43.1045 1203.138 43.1805 1207.29 ; <-- should change to "RECT 39.1045 1203.138 39.1805 1207.29"
END