DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Programming with awk

Files and pipes

You can provide input to an awk program by putting the input data into a file, say awkdata, and then executing

   $ awk 'program' awkdata<<Return>>
If no filenames are given, awk reads its standard input; thus, a second common arrangement is to have another program pipe its output into awk. For example, grep(1) selects input lines containing a specified regular expression, but it can do so faster than awk, since this is the only thing it does. We could, therefore, invoke the pipe
   $ grep 'Asia' countries | awk '. . .'<<Return>>
grep quickly finds the lines containing Asia and passes them on to the awk program for subsequent processing.
Next topic: Input separators
Previous topic: Input

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004