- 论坛徽章:
- 0
|
请问:awk: 对record排序
感觉上的确和BEGIN里FS = "\n"有关,原因不明
不过好在我最终的code用不上它,大家看看还有没改进的地方,code如下
- BEGIN {
- RS = ";"
- FS = ")"
- printf ("\n Generated at --- ")
- system("date")
- printf (" \n\n");
- }
- {if($0 !~ /USE CLOCK/) next}
-
- {
- new = 0
- for ( x = 1; x <= NF; x++)
- if($x ~/(NEW m|+ ROUTED m|\* )/)#if($x ~/00/)
- new = new + 1
- tmp_fout = NF - new - 2
- if(tmp_fout > 30) {
- out = ""
- for(x = 1 ; x < NF -new; x ++)
- out = sprintf("%s%s)",out, $x) #out + $i
- #printf ("\n\nFO: %d %s", NF-new-2, out)
- if(tmp_fout in fanout)
- fanout[tmp_fout] = sprintf("FO: %d %s \n\n%s", tmp_fout, out,fanout[tmp_fout])
- else
- fanout[tmp_fout] = sprintf("FO: %d %s\n", tmp_fout, out)
- if(tmp_fout > fout_max )
- fout_max = tmp_fout
- }
- }
- END {
- printf ("\n\nmax fanout on clock net: %d\n\n", fout_max)
- for(i = fout_max; i > 0; i--)
- if (i in fanout) print fanout[i]
- }
复制代码 |
|