RCP has asked for the wisdom of the Perl Monks concerning the following question:
The results should look like this:#!perl ## comp_prim_loc file > Location: X:75.4634 Y:15.875 Side: +1 Rotation:0 ## comp_locs file> Reference Designator: C1000 ## comp_locs file> Reference Designator: C1002 ## comp_locs file> Reference Designator: C1004 open(MYOUTFILE, ">align_comp_cc.txt"); open (FILEH, "comp_prim_loc"); while (<FILEH>) { chomp; if ( /Location:/i ) { tr/:)(/ /; ($xloc,$yloc,$rot) = (split)[2,4,8]; open(MYOUTFILE, ">>align_comps_cc.txt"); $count = $yloc; open (FILEH, "comp_locs"); while (<FILEH>) { chomp; if ( /Reference Designator:/i ) { ($name) = (split)[2]; my $count="`awk -v x=$count -v y=1.0 'BEGIN{ printf "%3f\n", x+y}'`"; print "\$\place_component_by_reference_with_mrf('$name', [['$xloc', '$ +count', 'BO\$board'], 0, 0], 0, \@NoRepeat);\n"; } } } } close(MYOUTFILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: awk issues
by Abigail-II (Bishop) on May 11, 2004 at 15:31 UTC | |
|
Re: awk issues
by runrig (Abbot) on May 11, 2004 at 15:14 UTC |