Title here
Summary here
gawk
defaults to using ERE mode.
First, create the foo
text file.
Here, the entire line is matched, equivalent to $0
.
$2 ~
specifies the use of the second field for matching.
Substitution, replaces the first matched string.
regex
:The regular expression to match.replacement
:The string to replace the match.target
:Optional, the target string, defaults to $0
.Not providing target
defaults to whole line matching.
Specify to replace the third column.
Global Substitution, globally replaces.
regex
:The regular expression to match.replacement
:The string to replace the match.target
:Optional, the target string, defaults to $0
.Not providing target
defaults to whole line matching.
Specify to replace the third column.
\<
indicates the start of a word.
\>
indicates the end of a word.
General Substitution, general replacement.
sub
and gsub
.sub
and gsub
do not support capture groups.regex
:The regular expression to match.replacement
:The replacement string, can use capture groups.how
:Can specify global or the Nth match replacement.target
:Optional, the target string, defaults to $0
.Using g
for global replacement.
Replace the second match.
\1
represents the first matched parameter.