Sream EDitor | SED
Docs and Resources
SED has a spec by the Open Group. GNU Sed is probably the best sed implementation to date (2022). Read its manual online.
Also see this amazing SED tutorial by Bruce Barnett.
Input data to sed
No need to do cat
or echo … | sed …
all the time.
$ sed '' poem1.txt
$ sed '' < poem1.txt
$ < poem1.txt sed ''
Print file contents
November 5, 2022
$ cat file.txt
$ sed '' file.tx (2)
$ sed -n p file.txt (3)
$ sed -n '1,$ p' file.txt (3)
-
Yeah, we could use
cat
. -
Or use an empty command, which by default (and without
-n
) just outputs the contents of the pattern space. -
Or using
-n
to avoid auto-printing of the pattern space and explicitly using thep
command to print, which prints all the lines if no address is used. -
Doing everything explicitly, that is, from line 1 to the last line, print.