.Dd Created:$Mdocdate$ .Dt ohazot_sed .Tg back_to_top .Bd -literal -compact _ _ ___ | |__ __ _ _______ | |_ / _ \\| '_ \\ / _` |_ / _ \\| __| | (_) | | | | (_| |/ / (_) | |_ \\___/|_| |_|\\__,_/___\\___/ \\__| .Ed .Tg menu .Bl -column ".Sy ohazot " ".Sy ohazot " ".Sy ohazot " .It Xr ohazot oh Ta | .Xr docs oh Ta | .Xr about oh Ta .El .Dd Created:2025-10-03|Updated:2025-10-06 .Dt ohazot_sed .Os OpenBSD linux .Nm sed .Nd usage and tips .Sh SUBSTITUTION .Sx back_to_top .Bl -dash -compact .It replace old with new .Dl s/old/new/ .It replace all occurrences .Dl s/old/new/g .It replace the second occurrence .Dl s/l/p/2 .D1 example .Dl echo "hello" | sed "s/l/p/2" returns "helpo" .El .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 .Sx back_to_top .Xr text_manipulation oh .Ss OpenBSD manpages .Xr sed 1 .Ss files .In sed.oh .Sh AUTHORS .Sx back_to_top .An -nosplit .Xr ohazot oh | .Xr about oh | .Lk https://ohazot.com ohazot.com .Aq Mt admin@ohazot.com