Help File
Wish List


Hosted by:
  VA Linux


Hawk / Ftwalk Comparisons: Awk

Awk is an event-driven programming language. It has a front end which reads from files (command line pathnames or standard input), splits the input into records and fields, tests the input according to various script expressions, and executes procedures whenever a test event is successful.

Ftwalk works the same way, only has been generalized to deal with a broader range of events, and has been specialized to deal with file searches. Ftwalk uses the same syntactic structure of test expressions and corresponding actions, and also has distinct BEGIN and END events, but input events are no longer limited to file records: they can be any sort of event, as defined by a modular input generator.

The default input generator for Ftwalk is a file search module. Command line pathnames are the starting point for a recursive file search, where each file found is an input event.

An alternative input generator is available which matches awk, so makes it possible to use Ftwalk for any programming task that awk is suitable for. This can be accessed by the -awk command line switch, or by placing the following line near the top of the Ftwalk script:

    #source awk
Users who are familiar with awk will find that almost everything that they know about awk can be applied to Ftwalk. The most important way that Ftwalk differs from awk is in its implementation of I/O streams: awk uses a very limited notation based on shell redirection/pipeline notation, whereas Ftwalk uses a more conventional notation with some C++-like embellishments.