Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

grep and print a unique line which has common words 1

Status
Not open for further replies.

RVSachin

Technical User
Nov 12, 2001
77
IN
Hi,

1. How do I grep for and print only the line
Actual Time : 130 MHz
if my file contains the following lines:

Required Time : 8.0 ns
Actual Time : 7.126 ns

Required Time : 150 MHz
Actual Time : 130 MHz


2. My second file has the following line:

Requested Estimated Requested Estimated Clock Clock
clk_core 100.0 MHz 28.1 MHz 10.000 35.545 -25.545 declared default_clkgroup

I grep for 'Estimated' and 'clkgroup' in this file to get these lines.
But, how do I print only a part of these lines as shown below:

Requested Estimated
clk_core 100.0 MHz 28.1 MHz

Note that none of the numerical values are constants here.

Thanks for your time.

RV
 
Something like this ?
1)
grep 'Actual Time.*MHz' /path/to/inputfile
2)
awk '
/Estimated/{print $1,$2}
/clkgroup/{print $1,$2,$3,$4,$5}
' /path/to/inputfile

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top