File: gawk.info, Node: Testing field creation, Next: Multiple Line, Prev: Splitting By Content, Up: Reading Files 4.8 Checking How 'gawk' Is Splitting Records ============================================ As we've seen, 'gawk' provides three independent methods to split input records into fields. The mechanism used is based on which of the three variables--'FS', 'FIELDWIDTHS', or 'FPAT'--was last assigned to. In addition, an API input parser may choose to override the record parsing mechanism; please refer to *note Input Parsers:: for further information about this feature. To restore normal field splitting after using 'FIELDWIDTHS' and/or 'FPAT', simply assign a value to 'FS'. You can use 'FS = FS' to do this, without having to know the current value of 'FS'. In order to tell which kind of field splitting is in effect, use 'PROCINFO["FS"]' (*note Auto-set::). The value is '"FS"' if regular field splitting is being used, '"FIELDWIDTHS"' if fixed-width field splitting is being used, or '"FPAT"' if content-based field splitting is being used: if (PROCINFO["FS"] == "FS") REGULAR FIELD SPLITTING ... else if (PROCINFO["FS"] == "FIELDWIDTHS") FIXED-WIDTH FIELD SPLITTING ... else if (PROCINFO["FS"] == "FPAT") CONTENT-BASED FIELD SPLITTING ... else API INPUT PARSER FIELD SPLITTING ... (advanced feature) This information is useful when writing a function that needs to temporarily change 'FS' or 'FIELDWIDTHS', read some records, and then restore the original settings (*note Passwd Functions:: for an example of such a function).