Contents | < Browse | Browse >
Running `awk' without Input Files
---------------------------------
You can also run `awk' without any input files. If you type the
command line:
awk 'PROGRAM'
then `awk' applies the PROGRAM to the "standard input", which usually
means whatever you type on the terminal. This continues until you
indicate end-of-file by typing `Control-d'.
For example, if you execute this command:
awk '/th/'
whatever you type next is taken as data for that `awk' program. If you
go on to type the following data:
Kathy
Ben
Tom
Beth
Seth
Karen
Thomas
`Control-d'
then `awk' prints this output:
Kathy
Beth
Seth
as matching the pattern `th'. Notice that it did not recognize
`Thomas' as matching the pattern. The `awk' language is "case
sensitive", and matches patterns exactly. (However, you can override
this with the variable `IGNORECASE'. Case-sensitivity)