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.

Finding certain string in file using bash shell scriot

Status
Not open for further replies.

Abdo_Mgdy

Newbie level 6
Joined
Aug 27, 2019
Messages
12
Helped
2
Reputation
4
Reaction score
2
Trophy points
3
Activity points
76
I need to develop bash shell script extracting capacitance values of nets from post pnr spf file and put them in a column vector.
The spf file is like following:


Code - [expand]
1
2
3
4
5
6
7
8
9
10
11
*|NET top33_dft_1/top33_orig_1/rf0_1/n503 0.008406PF
*|I (top33_dft_1/top33_orig_1/rf0_1/U924:A1
*+ top33_dft_1/top33_orig_1/rf0_1/U924 A1 I 0.002625PF 184.520 304.920)
*|I (top33_dft_1/top33_orig_1/rf0_1/U918:A2
*+ top33_dft_1/top33_orig_1/rf0_1/U918 A2 I 0.002814PF 189.000 289.240)
....
*|NET top33_dft_1/top33_orig_1/wradd_hold/FE_OFN38_smc18_rf_wradd_hold_1_
*+ 0.000132PF
*|I (top33_dft_1/top33_orig_1/wradd_hold/FE_OFC37_smc18_rf_wradd_hold_1_:ZN
*+ top33_dft_1/top33_orig_1/wradd_hold/FE_OFC37_smc18_rf_wradd_hold_1_ ZN 
....



I need to capture only the value after net name, i.e. first value after "*|NET". How can I do it??
 

This is a job for "sed" or "awk", but I think you should tell us the expected output from your example.
Is the "*|NET" always on the same line as the value?
 
It also looks like the value may be on the next line which the line continuation is denoted by "*+". See lines 7 & 8.

I think I would write a script with Python, Perl, Ruby, whatever than use command like sed/awk to do this. You can still call the script from a bash shell.
 

I need to develop bash shell script extracting capacitance values of nets from post pnr spf file and put them in a column vector.
The spf file is like following:


Code - [expand]
1
2
3
4
5
6
7
8
9
10
11
*|NET top33_dft_1/top33_orig_1/rf0_1/n503 0.008406PF
*|I (top33_dft_1/top33_orig_1/rf0_1/U924:A1
*+ top33_dft_1/top33_orig_1/rf0_1/U924 A1 I 0.002625PF 184.520 304.920)
*|I (top33_dft_1/top33_orig_1/rf0_1/U918:A2
*+ top33_dft_1/top33_orig_1/rf0_1/U918 A2 I 0.002814PF 189.000 289.240)
....
*|NET top33_dft_1/top33_orig_1/wradd_hold/FE_OFN38_smc18_rf_wradd_hold_1_
*+ 0.000132PF
*|I (top33_dft_1/top33_orig_1/wradd_hold/FE_OFC37_smc18_rf_wradd_hold_1_:ZN
*+ top33_dft_1/top33_orig_1/wradd_hold/FE_OFC37_smc18_rf_wradd_hold_1_ ZN 
....



I need to capture only the value after net name, i.e. first value after "*|NET". How can I do it??

Literally every programming language or scripting language can be used for parsing this. Use whatever you are more comfortable with. sed/awk look like good candidates here.
 

The output shoud be as follows:

Code - [expand]
1
2
3
4
5
6
0.008406
0.000132
...
[\syntax]
 
And, no the value does not always come in the same line

 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top