Living in the Shell #15; sed (Text Stream Editor) (Part 2)

sed ๐๏ธ
Edits streams by applying commonly used modifications.
Replace substring s
cat some-file.txt | sed 's/me/you/g'
Replaces all occurrences of "me" with "you".
Replace pattern s
echo "about\nabuse\namount" | sed 's/a\(\w*\?\)\w/\1/g'
bou bus moun
\1refers to the first captured group.
Transform to lowercase \L
echo "HELLO THERE\nHI THERE\nGOODBYE" | sed 's/H\w*/\L&/g'
hello There hi There GOODBYE
- Transforms words beginning with "H" to lowercase.
&is the place holder for "entire match".
Transform to uppercase \U
cat some-file.txt | sed 's/.*/\U&/g'
Transforms all letters into uppercase.
![Godoc-Lint: a linter for Go Doc Comments (godocs) [RE#16]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1741533596295%2F731ef95a-1af8-49ae-843d-a19d9d418fdf.png&w=3840&q=75)
![Optimize Postgres Containers for Testing [RE#15]](/_next/image?url=https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1741533395875%2Fe1a3c4fc-4354-4482-88b8-e8c14750e00a.png&w=3840&q=75)

