I have a file:
7 P-states (frequencies)
8 2.81 Ghz 100.0%
9 1400 Mhz 0.0%
10 1050 Mhz 0.0%
11 700 Mhz 0.0%
12 350 Mhz 0.0%
I could grep out the P-states line,but what i want is the next line,to extract the 100,and How?
It's sed,and thanks to kexin.the code is:
3 val=`sed -n -e '/P-states/{
4 n
5 p
6 }' busy.output | awk '{print $3}'`
7
8 echo $val
9
10 val=${val%.*}
11
12 echo $val
and "n" means i put the next line to pattern space,and "p" prints it,great!
阅读(1260) | 评论(0) | 转发(0) |