Home History Comparisons Examples Documentation Help File Download News Wish List Soapbox Project: Forums Tracker CVS Hosted by: Sourceforge VA Linux Author |
What Is Hawk / Ftwalk?Ftwalk is several things rolled into one:
Ftwalk was originally conceived of as a merger of the UNIX find and awk programs: a program that searches through the file system for files that meet any criteria, like find, but where the criteria and subsequent actions are specified like awk: as a series of test and action blocks. For example, if you wanted to search the file system to find all core files that have not been accessed in 7 or more days and remove those files, you might use the following UNIX command:
find / -name core -atime +7 -exec rm {} \;In Ftwalk the same command is:
ftwalk 'name("core") && atime > 7 {remove}' / For such simple cases Ftwalk is at least more readable, but the advantage of Ftwalk grows considerably when you want to search for more things in a single pass, and especially when you want to do something that find cannot grasp. Consider the following Ftwalk script:
ftwalk ' mtime < 7 {x[dirname] += sizeb} END {for (i in x) printf("%8d %s\n", x[i], i)}' $HOMEThis script tells you how many disk blocks are used by files that have been modified in the last seven days in each directory under your home directory: a quick first step to finding out where the disk space that you had last week has gone. The current implementation of Ftwalk goes far beyond the initial concept, adding a rich type system, a wealth of built-in functions, an interactive monitor, on-line hypertext help, and much more.
|