May 2017
Beginner
552 pages
28h 47m
English
The & symbol is the matched string. This value can be used in the replacement string:
$ echo this is an example | sed 's/\w\+/[&]/g'
[this] [is] [an] [example]
Here, the \w\+ regex matches every word. Then, we replace it with [&], which corresponds to the word that is matched.