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

Multi-line records

Records are normally separated by newlines, so that each line is a record; but this too can be changed, though only in a limited way. If the built-in record separator variable RS is set to the empty string, as in

   BEGIN   { RS = "" }
then input records can be several lines long; a sequence of empty lines separates records. A common way to process multiple-line records is to use
   BEGIN   { RS = ""; FS = "\n" }
to set the record separator to an empty line and the field separator to a newline. Each line is then one field. However, the length of a record is limited; it is usually about 2500 characters. ``The getline function'' and ``Cooperation with the shell'' show other examples of processing multi-line records.
Next topic: The getline function
Previous topic: Input separators

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