From 531cf0ed26f857c2a2d3b13baf70eae72cefe6f7 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 24 Nov 2018 19:30:55 +0200 Subject: Allow command line assignment of typed regexps. --- doc/gawktexi.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/gawktexi.in') diff --git a/doc/gawktexi.in b/doc/gawktexi.in index e7959d83..97d91172 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -11023,6 +11023,22 @@ sequences (@pxref{Escape Sequences}). @value{DARKCORNER} +Normally, variables assigned on the command line (with or without the +@option{-v} option) are treated as strings. When such variables are +used as numbers, @command{awk}'s normal automatic conversion of strings +to numbers takes place, and everything ``just works.'' + +However, @command{gawk} supports variables whose types are ``regexp''. +You can assign variables of this type using the following syntax: + +@example +gawk -v 're1=@/foo|bar/' '@dots{}' /path/to/file1 're2=@/baz|quux/' /path/to/file2 +@end example + +@noindent +Strongly typed regexps are an advanced feature (@pxref{Strong Regexp Constants}). +We mention them here only for completeness. + @node Conversion @subsection Conversion of Strings and Numbers -- cgit v1.2.3