Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract data from strings in file in this case, in linux?
    primarykey
    data
    text
    <p>I have a file with lines that look like this:</p> <pre><code> IBACS6XX P24 ( .PADM(TEST_3), .QC(P1_87P_Z_3) ); OBAXXCSXX08 P77 ( .A(P1_158P_N1_PROBE_SEL), .PADM(N1_SELECT) ); inv0_p U99 ( .A(P1_P1_2P_P1_P1_19P_Z_0), .Q(n00) ); IBACS6XX P25 ( .PADM(TBUSREQN), .QC(tbusreqn) ); IBACS6XX P26 ( .PADM(NX_N2N), .QC(P1_177P_Z_0) ); OBAXXCSXX08 P27 ( .A(P1_158P_N2G6PC), .PADM(N2G6PCC) ); OBAXXCSXX08 P28 ( .A(P1_158P_N1G6PC), .PADM(N1G6PCC) ); IOACS3P6CSXE04 P46 ( .A(P1_158P_DOUT_7), .EN(FE_OFN21_P1_158P_DATA_OUTN), .PADM(DATA_7), .MA(LTIEHI_5_NET), .MB(P1_87P_Z_0_INV), .QC(P1_49P_ZI_7) ); IOACS3P6CSXE04 P47 ( .A(P1_158P_DOUT_6), .EN(FE_OFN21_P1_158P_DATA_OUTN), .PADM(DATA_6), .MA(LTIEHI_5_NET), .MB(P1_87P_Z_0_INV), .QC(P1_49P_ZI_6) ); </code></pre> <p>Now to the question, I wish to extract 3 items of data and put them into a new file separated by space character</p> <p>(1) The first item e.g IBACS3XX in the first line</p> <p>(2) the second item that starts with P followed by 2 digits and is usually 3 characters long. After the second item we always get an opening bracket. e.g P24 in the first line</p> <p>(3) and the item between .PADM( and the closing bracket ) e.g TEST_3 in the first line</p> <p>How do I do this in Linux? Do you have a better way?</p> <p>The problems are:</p> <p>(1) Some line are broken into two lines and thus the .PADM( may end up in the second line instead as can be seen in the last 2 examples.</p> <p>(2) The .PADM( does not always apppear at the same place in the line as can be seen in the second example.</p> <p>(3) All lines are not of interest, only those lines that start with IBA OBA or IOA as can be seen above. If a line does not start with these characters than it can be ignored. This is a portion of a netlist file.</p> <p>All lines are "closed" with ';' symbol, otherwise they continue to the next line in text file.</p> <p>I assume that awk and sed is to be used in some combination but not sure how.</p> <p>EDIT:</p> <p>It works perfectly, now a small step is to filter out these from the netlist as well:</p> <pre><code> ggppxbp P74 ( ); ggppxbp P74VDD ( ); ggppxbg P75 ( ); ggppxbg P75VSS ( ); </code></pre> <p>I just want to discard the last braket and semicolon. These cells always start with ggppxb and the last letter tells whether it is 5v or GND connection thus the last letter only will change.</p> <p>I think that I can put ggppxbp into the if statement after the || symbol. But, how do I discard the bracket and the semicolon and include the remaining two items into the output file?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload