Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

Finding certain string in file using bash shell scriot

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??
 

std_match

Advanced Member level 4
Joined
Jul 9, 2010
Messages
1,154
Helped
437
Reputation
874
Reaction score
404
Trophy points
1,363
Location
Sweden
Activity points
8,864
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?
 

ads-ee

Super Moderator
Staff member
Joined
Sep 10, 2013
Messages
7,629
Helped
1,771
Reputation
3,548
Reaction score
1,715
Trophy points
1,393
Location
USA
Activity points
57,642
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.
 

ThisIsNotSam

Advanced Member level 5
Joined
Apr 6, 2016
Messages
2,028
Helped
357
Reputation
714
Reaction score
357
Trophy points
83
Activity points
10,195
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.
 

Abdo_Mgdy

Newbie level 6
Joined
Aug 27, 2019
Messages
12
Helped
2
Reputation
4
Reaction score
2
Trophy points
3
Activity points
76
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

 

Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top