How to replace netname with net expression

Guest
Does anyone know how can I replace all net names like net0111 with net
expression [@net0100:%:net0100!]. I've imported spectre netlist and
need to do such replacement. Thanks
 
Hi,

The is a one-liner Perl that could do the trick for you. Just type in
the following into your UNIX prompt:

perl -i.bak -ne 's/(net\d+)/\[\@$1:%:$1!\]/ig;' -ne print
SpectreNetlist.scs

So if your SpectreNetlist.scs contans :
//
net01 myNEt01
net345
net564
net45 prefixneT45suffix
net45
//
Then this command will edit your file in place to make it like this:
//
[@net01:%:net01!] my[@NEt01:%:NEt01!]
[@net345:%:net345!]
[@net564:%:net564!]
[@net45:%:net45!] prefix[@neT45:%:neT45!]suffix
[@net45:%:net45!]
//
A copy of your original netlist is saved as SpectreNetlist.scs.bak

BTW this script does not convert net0111 into net0100 as you mentioned
above. In other words, the number 0111 is not converted into 0100. I
guess was a typo in your post.

You have got to learn working with regular expressions, no matter the
language, in case you need to do this sort of things regularly.

Cheers,
Riad.
 

Welcome to EDABoard.com

Sponsor

Back
Top