.Dd Created:2025-10-03|Updated:2025-10-21| .de ocsi \\$* , .. .de oxr .ocsi .Xr \\$* .. .de oit .It \\$* .. .de obdi .Bl -dash -compact .oit \\$* .. .de obdl .Bd -literal -compact \\$* .. .de onote .Bl -hang -compact .oit \\$* .El .. .de ocomm .Bl -diag -compact .oit \\$* .El .. .de opsy .Pp .Sy - \\$* .. .de obc .Bl -column \\$* .. .de obc2 .obc opt desc .. .de obc3 .obc option arguments description .. .Dt SED oh .Os OpenBSD 7.7 linux| .Nm sed .Nd usage and tips .Sh SUBSTITUTION .obc2 .It replace old with new Ta : Li s/old/new/ .It replace all occurrences Ta : Li s/old/new/g .It replace the second occurrence Ta : Li s/l/p/2 .El .Ss Examples .obdl $ echo \&"hello\&" | sed \&"s/l/p/\&" heplo $ echo "hello" | sed "s/l/p/g" heppo $ echo "hello" | sed "s/l/p/2" helpo .Ed .Ss path variables The typical separator is /, which can conflict with pathnames. An option is to use another character as a separtor, eg.: @ : .Bd -literal -compact echo "/some/path" | sed "s/\\/some\\/path/\\/other\\/directory/" echo "/some/path" | sed "s@/some/path@/other/directory@" .Ed .Sh SEE ALSO .Xr text_manipulation oh .opsy OpenBSD manpages: .Xr sed 1 .El .Sh AUTHORS .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com