Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[Moved] perl find all keywords and save the lines with keywords into string

Status
Not open for further replies.

nelly1

Junior Member level 3
Joined
Jun 14, 2012
Messages
29
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,495
hallo all,

I wanna write perl to achieve:
find all keywords in the text, and save the lines with keywords into string,then spilt, save the first column to array.
for example,
keywords: nmos
text:
M0 (net1 net2 0 0) nmos
M1 (net2 net3) pmos
M2 (net4 net5 0) nmos

finally, i wanna a array_nmos which contain M0 M2

thanks a lot!!
 

Re: perl find all keywords and save the lines with keywords into string

How is perl related to analog circuit design?
 

Re: perl find all keywords and save the lines with keywords into string

wanne write a automatic device check, so use perl to write ocean script...
 

Re: perl find all keywords and save the lines with keywords into string

My point was do you think that the analog circuit design section is the right one for a perl script?
 

Re: perl find all keywords and save the lines with keywords into string

I'm quite sure i need perl to write what i need...
It's just a example, like using perl to find keywords and save the line
 

hay nelli,

I wrote scripts that suits for u..

Code:
open(INPUT,"input") ;
$line=<INPUT>;
while($line ne "")
{
if($line =~ /nmos/) {
 @array= split(/[\t +]/, $line);
$array_nmos[$nmoscount++] = $array[0];
}
$line=<INPUT>;
}	
print @array_nmos;

:p
 
Last edited by a moderator:

thanks a lot! i solved it with map and grep function. but will try ur codes :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top