PolyPusher wrote:
Hi All,
Hello,
I have some Perl experience but has been awhile. I mainly write SKILL lisp programs for Cadence CAD for a layout group(we are a IC design center). I have a CBR(describes circuit) file and want to open it, find the line in file
Is it just one line or are there multiple lines that match?
.SUBCKT __RE1321_4 HB_GND GSM_RX DCS_RX DCS_VRX GSM_VRX PCS_TX SHUNT_GND ANT + VRXEN GSM_VTX GSM_TX PCS_VTX Where .SUBCKT __RE1321_4 is found and the output of the file is the pins(ignore the + sign)
Ignore the + sign because? Does it signify a continuation character with the remaining pins on the next line?
Output: ("HB_GND" "GSM_RX" "DCS_RX" "DCS_VRX" "The rest of 'em") The above is a list that can be used by SKILL code. I only understand the very basics of perl, the more info the better. Thank you in advance for any help, Eric What I have so far..... #!/usr/bin/perl use warnings; use strict; my $read_file = 'RE1321_4.cbr'; my $write_file = 'NavInputPins.list'; open READ, '<', $read_file or die "Can't open '$read_file' $!"; open WRITE, '>', $write_file or die "Can't open '$write_file' $!";
All you need here is a while loop to read lines and print out the results. If your "line" is actually two lines then you need to handle that as well. If you are only looking for the one line then you can exit the loop as soon as you find it instead of reading through the entire file. Provide some more information and it should be easy to write.
close READ or die "Couldn't close '$read_file' $!"; close WRITE or die "Couldn't close '$write_file' $!"; exit 0; __END__
John -- The programmer is fighting against the two most destructive forces in the universe: entropy and human stupidity. -- Damian Conway -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/