Name

sub

Synopsis

sub(regex, str [, target])

Substitute str for first match of the regular expression regex in the string target. If target is not supplied, defaults to $0. Returns 1 if successful, 0 otherwise. Use & in the replacement string to stand for the text matched by the pattern.

Get Linux in a Nutshell, 6th 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.