8.13. Counting Files by TypesI use awk (Section 20.10) a lot. One of my favorite features of awk is its associative arrays. This means awk can use anything as an index into an array. In the next example, I use the output of the file (Section 12.6) command as the index into an array to count how many files there are of each type: xargs Section 28.17
The output of this might look like: 38 ascii text 32 English text 20 c program text 17 sparc executable not stripped 12 compressed data block compressed 16 bits 8 executable shell script 1 sparc demand paged dynamically linked executable 1 executable /bin/make script -- BB
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|