sed Getting started with sed

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Remarks

Versions

NameInitial ReleaseVersionRelease Date
POSIX sed1992IEEE Std 1003.1, 2013 Edition2013-04-19
BSD sed1992FreeBSD 10.3 / NetBSD 7.0 / OpenBSD 5.92016-04-04
GNU sed19894.2.22012-12-22

Hello World

One of the most common use of Sed is text substitution that can be achieved with the s command.

In a terminal, type echo "Hello sed" | sed 's/sed/World/' and press Enter:

$ echo "Hello sed" | sed 's/sed/World/'
Hello World
 

"Hello World" should be output to the terminal.

The string "Hello, sed" is sent via pipe as input to the sed command that replace the word sed with World .

The syntax of a basic substitution command is s followed by the string or pattern to be searched and the substitution text. s command and strings are separated with a default / delimiter.



Got any sed Question?