Bash
From Vlsiwiki
Revision as of 01:36, 23 August 2009 by Tom Golubev (Talk | contribs) (Added total line count of files containing MMU in their name)
Here are some of my BASH tricks
Find files containing MMU in the name, do a line count, and them add them up. The first part finds files, then redirects the output of the line counts to a temp file
[tom@garak gaisler]$ for i in $(find|grep mmu); do wc $i -l; done>~/leon3_mmu_linecount
The output file: 655 ./leon3/mmutlb.vhd 351 ./leon3/mmuconfig.vhd 258 ./leon3/mmutw.vhd 176 ./leon3/mmulru.vhd 1559 ./leon3/mmu_dcache.vhd 202 ./leon3/libmmu.vhd 245 ./leon3/mmuiface.vhd 609 ./leon3/mmu.vhd 148 ./leon3/mmu_cache.vhd 189 ./leon3/mmutlbcam.vhd 380 ./leon3/mmu_acache.vhd 111 ./leon3/mmulrue.vhd 662 ./leon3/mmu_icache.vhd
The second part cuts the first field of the file, which is an integer containing the line count, and add all of them up
[tom@garak gaisler]$ PASS=0;for i in $(cat ~/leon3_mmu_linecount|cut -d" " -f1); do PASS=$(($PASS+$i)); done; echo $PASS lines total 5545 lines total --Done--