herman4016 has asked for the wisdom of the Perl Monks concerning the following question:
Following are contents of tt.txt,
.dout_sar ( dout_sar ) , .dcoc_status ( dcoc_status ) , .sdm_yout_i ( {sdm_yout_i[1] , n145 } ) , .sdm_yout_q ( sdm_yout_q ) ,I want to grep :
.sdm_yout_i ( {sdm_yout_i[1] , n145 } )Following is my code , but the result is nothing , please help !!
#!/usr/bin/perl use 5.010; use strict; use warnings; my $port_name = 'sdm_yout_i[1]'; open my $fh, "tt.txt" or die $!; while (<$fh>) { if ($_ =~ /\.([0-9a-z_]*?) \(.*?${port_name} .*?,/) { print '$port_name = ' ; say $port_name; print 'cell name = ' ; say $1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expressions with varialbe with "[]" (Verilog)
by toolic (Bishop) on Mar 10, 2015 at 14:06 UTC | |
by herman4016 (Acolyte) on Mar 12, 2015 at 02:27 UTC | |
|
Re: Regular Expressions with varialbe with "[]"
by choroba (Cardinal) on Mar 10, 2015 at 14:04 UTC | |
|
Re: Regular Expressions with varialbe with "[]"
by hdb (Monsignor) on Mar 10, 2015 at 14:04 UTC | |
|
Re: Regular Expressions with varialbe with "[]"
by Anonymous Monk on Mar 10, 2015 at 14:12 UTC | |
|
Re: Regular Expressions with varialbe with "[]"
by SuicideJunkie (Vicar) on Mar 10, 2015 at 15:30 UTC | |
|
Re: Regular Expressions with varialbe with "[]"
by pme (Monsignor) on Mar 10, 2015 at 14:25 UTC | |
by herman4016 (Acolyte) on Mar 12, 2015 at 02:41 UTC |