Name

gsub

Synopsis

gsub(regex, str [, target])

Globally substitute str for each match of the regular expression regex in the string target. If target is not supplied, default to $0. Return the number of substitutions. Use & in the replacement string to stand for the text matched by the pattern.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.