manpagez: man pages & more
info gawk
Home | html | info | man

gawk: Naming Standard Input

 
 2.4 Naming Standard Input
 =========================
 
 Often, you may wish to read standard input together with other files.
 For example, you may wish to read one file, read standard input coming
 from a pipe, and then read another file.
 
    The way to name the standard input, with all versions of 'awk', is to
 use a single, standalone minus sign or dash, '-'.  For example:
 
      SOME_COMMAND | awk -f myprog.awk file1 - file2
 
 Here, 'awk' first reads 'file1', then it reads the output of
 SOME_COMMAND, and finally it reads 'file2'.
 
    You may also use '"-"' to name standard input when reading files with
 'getline' (⇒Getline/File).
 
    In addition, 'gawk' allows you to specify the special file name
 '/dev/stdin', both on the command line and with 'getline'.  Some other
 versions of 'awk' also support this, but it is not standard.  (Some
 operating systems provide a '/dev/stdin' file in the filesystem;
 however, 'gawk' always processes this file name itself.)
 
© manpagez.com 2000-2018
Individual documents may contain additional copyright information.