# Finding certain string in file using bash shell scriot

#### Abdo_Mgdy

##### Newbie level 6
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)
....
*+ 0.000132PF
....

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

#### std_match

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?

Abdo_Mgdy

### Abdo_Mgdy

points: 2

##### Super Moderator
Staff member
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

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)
....
*+ 0.000132PF
....

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