Script/command to find the common element from 2 reports


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script/command to find the common element from 2 reports
# 1  
Old 06-23-2012
Script/command to find the common element from 2 reports

please look the scenario

Last edited by dll_fpga; 06-23-2012 at 02:44 AM.. Reason: correction
# 2  
Old 06-23-2012
From my point of view the first difference between the two occurs at the second line:

Code:
(rising edge-triggered flip-flop clocked by CLK1)

is not the same in the second report output.


Are you only interested in differences after Point Incr Path maybe?
# 3  
Old 06-23-2012
hi agama,
Please ignore my previous report
The startpoint will be always same but the endpoint is different ,across various reports and im looking for a search between "clock network delay(propagated)" and "data arrival time" ....to find the element which is common in both reports(reports are seperated by ++,for viewing purpose..)
For eg:here it is
(TC81) to (TC83)
afterwards it is different for the first 2 report...
so i should get the output as TC83
I need a command/script to find the common element across multiple reports...ie till what point both are same
for this example the command/script should give output as TC83

Code:
Startpoint: ff1
               (rising edge-triggered flip-flop clocked by CLK1)
 Endpoint: ff2
               (rising clock gating-check end-point clocked by CLK2)
  Path Group: **clock_gating_default**
  Path Type: min
 
  Point                                                                                                                   Incr       Path
   ---------------------------------------------------------------------------------------------------------------------------------------------
  clock CLK1 (rise edge)                                                                                                                                                                  
clock network delay (propagated)                                                                             
 (TC81)                        
 (TC82)                     
 (TC83)                         
 (TC84)                       
 (TC85)                           
  data arrival time                                                                                                         
                                                                                                      
   ---------------------------------------------------------------------------------------------------------------------------------------------
  data required time                                                                                                              128.222
  data arrival time                                                                                                                -50.561
   ---------------------------------------------------------------------------------------------------------------------------------------------
  slack (VIOLATED)                                                                                                               -12.661
 
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Startpoint: ff1
               (rising edge-triggered flip-flop clocked by CLK1)
 Endpoint: ff4
               (rising clock gating-check end-point clocked by CLK4)
  Path Group: **clock_gating_default**
  Path Type: min
 
  Point                                                                                                                   Incr       Path
   ---------------------------------------------------------------------------------------------------------------------------------------------
  clock CLK1 (rise edge)                                                                                       
  clock network delay (propagated)                                                                             
 (TC81)                        
 (TC82)                     
 (TC83)                         
 (M4)                       
 (M5)                           
                                                                                                   data arrival time 
   ---------------------------------------------------------------------------------------------------------------------------------------------
  data required time                                                                                                              12.222
  data arrival time                                                                                                                -5.561
   ---------------------------------------------------------------------------------------------------------------------------------------------
  slack (VIOLATED)                                                                                                               -1.661

Quote:
Originally Posted by agama
From my point of view the first difference between the two occurs at the second line:

Code:
(rising edge-triggered flip-flop clocked by CLK1)

is not the same in the second report output.


Are you only interested in differences after Point Incr Path maybe?

Last edited by Scrutinizer; 06-23-2012 at 04:10 AM.. Reason: code tags
# 4  
Old 06-23-2012
Try:

Code:
awk -F'[()]' '
  /clock network delay/{
    f=1
    nr_of_reports++
    getline
  } 
  /data arrival time/{
    f=0
  }
  f{
    A[$2]++
  }
  END{
    for(i in A) if(A[i]==nr_of_reports) print i
  }
' infile

Output:
Code:
TC81
TC82
TC83


--
On Solaris use /usr/xpg4/bin/awk rather than awk
This User Gave Thanks to Scrutinizer For This Post:
# 5  
Old 06-23-2012
hi Scrutinizer,
thanks a lot...
Please help me how to run this script,as i'm a basic level user in unix...
I have the reports in a file called reports.txt
I donno how to run this script ....
If possible please help me understand how its working?


Quote:
Originally Posted by Scrutinizer
Try:

Code:
awk -F'[()]' '
  /clock network delay/{
    f=1
    nr_of_reports++
    getline
  } 
  /data arrival time/{
    f=0
  }
  f{
    A[$2]++
  }
  END{
    for(i in A) if(A[i]==nr_of_reports) print i
  }
' infile

Output:
Code:
TC81
TC82
TC83

# 6  
Old 06-23-2012
Change "infile" to the path/name of the actual file. Then just try copy-pasting the script on the command line

Perhaps you are more comfortable with the single-line form:
Code:
awk -F'[()]' '/clock network delay/{f=1; r++; getline} /data/{f=0} f{A[$2]++} END{for(i in A)if(A[i]==r)print i}' infile

You can also put the script in a file, make it executable and then run it.
This User Gave Thanks to Scrutinizer For This Post:
# 7  
Old 06-23-2012
Hi scrutinizer...
after opening the reports.txt in vi editor ...how can i run this command?
Is it possible to run this within the vi editor ...rather than command prompt
Also will this script work if i have multiple instances to search within a reports(here for example it was only 2 instances ) with the same start point and end points differnt....



Quote:
Originally Posted by Scrutinizer
Change "infile" to the path/name of the actual file. Then just try copy-pasting the script on the command line

Perhaps you are more comfortable with the single-line form:
Code:
awk -F'[()]' '/clock network delay/{f=1; r++; getline} /data/{f=0} f{A[$2]++} END{for(i in A)if(A[i]==r)print i}' infile

You can also put the script in a file, make it executable and then run it.

Last edited by dll_fpga; 06-23-2012 at 05:04 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find first n element by matching IDs

Hi All I have a problem that I am not able to resolve. Briefly, I have a file like this: ID_1 10 ID_2 15 ID_3 32 ID_4 45 ID_5 66 ID_6 79 ID_7 88This file is numerically ordered for the 2th column. And another file containing a list of IDs(just one in this example) ID_4What I... (7 Replies)
Discussion started by: giuliangiuseppe
7 Replies

2. Shell Programming and Scripting

Shell Script to find common lines and replace next line

I want to find common line in two files and replace the next line of first file with the next line of second file. (sed,awk,perl,bash any solution is welcomed ) Case Ignored. Multiple Occurrence of same line. File 1: hgacdavd sndm,ACNMSDC msgid "Rome" msgstr "" kgcksdcgfkdsb... (4 Replies)
Discussion started by: madira
4 Replies

3. Shell Programming and Scripting

Find common entries

Hi all I have to compare two files and find common entries First file is like this XVY CVY ZYN MNA In second file I have to search these entries in even number of columns 5 XVY 7 hdfj 8 CVY 9 if there is common entries then out put shuld be 5 XVY(approved) 7 hdfj 8... (11 Replies)
Discussion started by: manigrover
11 Replies

4. Shell Programming and Scripting

Script/command to find the common element from 2 reports

Please see the below reports.... The startpoint will be always same but the endpoint is different ,across various reports and im looking for a search between "clock network delay(propagated)" and "data arrival time" ....to find the element which is common in both reports(reports are seperated... (0 Replies)
Discussion started by: dll_fpga
0 Replies

5. Shell Programming and Scripting

Find if XML element has a matching required element

I want to check if every <Part> element has corresponding <Description> in this sample XML. ....<Lot Of XML> <Inv lineNumber="2"> <Item> ... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Shell Programming and Scripting

Need to find root element name of XML file

Given this XML: <?xml version="1.0"?> <catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> ... (2 Replies)
Discussion started by: ricksj
2 Replies

7. Shell Programming and Scripting

Script to find NOT common strings in two files

Hi all, I'd like you to help or give any advise about the following: I have two (2) files, file1 and file2, both files have information common to each other. The contents of file1 is a subset of the contents of file2: file1: errormsgadmin esdp esgservices esignipa iprice ipvpn irm... (18 Replies)
Discussion started by: hnux
18 Replies

8. Shell Programming and Scripting

Script to find NOT common strings in two files

Hi all, I'd like you to help or give any advise about the following: I have two (2) files, file1 and file2, both files have information common to each other. The contents of file1 is a subset of the contents of file2: file1: errormsgadmin esdp esgservices esignipa iprice ipvpn irm... (0 Replies)
Discussion started by: hnux
0 Replies

9. Shell Programming and Scripting

Simple script to find common strings in two files

Hi , I want to write a simple script. I have two files file1: BCSpeciality Backend CB CBAPQualDisp CBCimsVFTRCK CBDSNQualDisp CBDefault CBDisney CBFaxMCGen CBMCGeneral CBMCQualDisp file2: CSpeciality Backend (8 Replies)
Discussion started by: ramky79
8 Replies

10. UNIX for Advanced & Expert Users

Why command df and du reports different output?

There a mismatch between df and du outputs Both df and du reporting different output. It is confusing. the answer that I get is that Open file descriptor is main causes of such wrong information. For example if file is open by third party application OR by a user and same file is deleted, both... (3 Replies)
Discussion started by: ynixon
3 Replies
Login or Register to Ask a Question