gsub ( reg, sub, var );
This built-in function will substitute var for each substring matching the regular expression reg in string sub. No value is returned. The regular expressions can be expressed as a sting constant or string value. The parameter reg is a regular expression or a variable assigned a regular expression, sub is a string constant, and var is a string variable. To put it another way, reg is the old string or pattern that you want replaced, sub is the new string that you want to have in place of reg, and var is the chunk of data where you want the replacement to happen.
Example
Gsub(/ +/, " ", $0);
# Replace runs of blanks in input line with single blank
Last modified date: 12/03/2024