6
Processing Words
The programs in this chapter share a common theme: the manipulation of natural language text. The examples include programs that generate random words and sentences, that carry on limited dialogues with the user, and that process text. Most are toys, of value mainly as illustrations, but some of the document preparation programs are in regular use.
6.1 Random Text Generation
Programs that generate random data have many uses. Such programs can be created using the built-in function rand
, which returns a pseudo-random number each time it is called. The rand
function starts generating random numbers from the same seed each time a program using it is invoked, so if you want a different sequence each time, you must call srand( ...
Get The AWK Programming Language, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.