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.

Questions about using and learning Perl script

Status
Not open for further replies.

badola

Member level 5
Member level 5
Joined
Jan 4, 2008
Messages
89
Helped
7
Reputation
14
Reaction score
5
Trophy points
1,288
Location
bangalore
Activity points
1,786
i have a file of some 22000 lines....after each line i have a pattern of numbers like ..for example...88.3125....
i want to remove this number from all the lines...so i want a perl script for it..
can you help me in this??????
how can i read a file in perl script?
 

perl help

ONE WAY at the time i feel ,
u can read the each line of file at a time and split the each line take in to array ,and rejoin except the last element put it in another file

while ( < >) {
@a = split ($_)
x =@a
join (@b. a...
put b
}
 

Re: perl help

Badola,

Instead of perl script, u can do it by opening the file in VI editor and typing the following command
:%s/pattern_to_be_replaced//g

Sree
 

Re: perl help

thnks for ur help...
now i got another solution...
we can do this thing using recording option of vi editor......
 

perl help

or you can do use inline editing in perl without even opening the file.

shell$ perl -pi "s/\d+\.\d+$//" filename

This will modify filename with the regex applied to each line.
 

Re: perl help

any good examples of perl for verification ?
 

Re: perl help

am upgrading on PERL. I need help regarding how to write a perl script to automate the operations in Modelsim. Like compiling, simulating, adding wave...

am working on windows... whether its possible to invoke modelsim through a perl script?

kindly help...!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top