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

Output separators

The output field separator and record separator are held in the built-in variables OFS and ORS. Initially, OFS is set to a single blank and ORS to a single newline, but these values can be changed at any time. For example, the following program prints the first and second fields of each record with a colon between the fields and two newlines after the second field:

   BEGIN  { OFS = ":"; ORS = "\n\n" }
          { print $1, $2 }
Notice that
   	{ print $1 $2 }
prints the first and second fields with no intervening output field separator because $1 $2 is a string consisting of the concatenation of the first two fields.
Next topic: The printf statement
Previous topic: The print statement

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005