gawk: Viewing And Changing Data

1 
1 14.3.3 Viewing and Changing Data
1 --------------------------------
1 
1 The commands for viewing and changing variables inside of 'gawk' are:
1 
1 'display' [VAR | '$'N]
1      Add variable VAR (or field '$N') to the display list.  The value of
1      the variable or field is displayed each time the program stops.
1      Each variable added to the list is identified by a unique number:
1 
1           gawk> display x
1           -| 10: x = 1
1 
1      This displays the assigned item number, the variable name, and its
1      current value.  If the display variable refers to a function
1      parameter, it is silently deleted from the list as soon as the
1      execution reaches a context where no such variable of the given
1      name exists.  Without argument, 'display' displays the current
1      values of items on the list.
1 
1 'eval "AWK STATEMENTS"'
1      Evaluate AWK STATEMENTS in the context of the running program.  You
1      can do anything that an 'awk' program would do: assign values to
1      variables, call functions, and so on.
1 
1 'eval' PARAM, ...
1 AWK STATEMENTS
1 'end'
1      This form of 'eval' is similar, but it allows you to define "local
1      variables" that exist in the context of the AWK STATEMENTS, instead
1      of using variables or function parameters defined by the program.
1 
1 'print' VAR1[',' VAR2 ...]
1 'p' VAR1[',' VAR2 ...]
1      Print the value of a 'gawk' variable or field.  Fields must be
1      referenced by constants:
1 
1           gawk> print $3
1 
1      This prints the third field in the input record (if the specified
1      field does not exist, it prints 'Null field').  A variable can be
1      an array element, with the subscripts being constant string values.
1      To print the contents of an array, prefix the name of the array
1      with the '@' symbol:
1 
1           gawk> print @a
1 
1      This prints the indices and the corresponding values for all
1      elements in the array 'a'.
1 
1 'printf' FORMAT [',' ARG ...]
1      Print formatted text.  The FORMAT may include escape sequences,
1      such as '\n' (⇒Escape Sequences).  No newline is printed
1      unless one is specified.
1 
1 'set' VAR'='VALUE
1      Assign a constant (number or string) value to an 'awk' variable or
1      field.  String values must be enclosed between double quotes
1      ('"'...'"').
1 
1      You can also set special 'awk' variables, such as 'FS', 'NF', 'NR',
1      and so on.
1 
1 'watch' VAR | '$'N ['"EXPRESSION"']
1 'w' VAR | '$'N ['"EXPRESSION"']
1      Add variable VAR (or field '$N') to the watch list.  The debugger
1      then stops whenever the value of the variable or field changes.
1      Each watched item is assigned a number that can be used to delete
1      it from the watch list using the 'unwatch' command.
1 
1      With a watchpoint, you may also supply a condition.  This is an
1      'awk' expression (enclosed in double quotes) that the debugger
1      evaluates whenever the watchpoint is reached.  If the condition is
1      true, then the debugger stops execution and prompts for a command.
1      Otherwise, 'gawk' continues executing the program.
1 
1 'undisplay' [N]
1      Remove item number N (or all items, if no argument) from the
1      automatic display list.
1 
1 'unwatch' [N]
1      Remove item number N (or all items, if no argument) from the watch
1      list.
1