Bash - sub,gsub
regex Using: sub
, gsub
-> (Global sub)
- sub (pattern, replacement, x)
- gsub (pattern, replacement, x)
sub ("little", "big", "Mary has a little lamb.")
# Substitutes ONLY the first occurrence of the word "little" by another word "big".
“Mary has a big lamb.”
-
sub(pattern, replacement, x, ignore.case = FALSE, fixed = FALSE, useBytes = FALSE)
-
gsub(pattern, replacement, x, ignore.case = FALSE)
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.