sed '5d' Delete line 5
sed '/[Tt]est/d' Delete all lines containing Test or test
sed -n '20,25p' text Print only lines 20 through 25 from text
sed '1,10s/unix/UNIX/g' intro Change unix to UNIX wherever it appears in the first 10 lines of intro
sed '/jan/s/-1/-5/' Change the first -1 to -5 on all lines containing jan
sed 's/...//' data Delete the first three characters from each line of data
sed 's/...$//' data Delete the last 3 characters from each line of data
sed -n 'l' text Print all lines from text, showing nonprinting characters as /nn (where nn is the octal value of the character), and tab characters as /t
$ cat intro
The Unix operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
the design of the Unix system was to create an
environment that promoted efficient program
development.
$
$ sed 's/Unix/UNIX/' intro Substitute Unix with UNIX
The UNIX operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
the design of the UNIX system was to create an
environment that promoted efficient program
development.
$
$ sed -n '1,2p' intro Just print the first 2 lines
The UNIX operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
$
$ sed -n '/UNIX/p' intro Just print lines containing UNIX
The UNIX operating system was pioneered by Ken
the design of the UNIX system was to create an
$
$ sed '1,2d' intro Delete lines 1 and 2
in the late 1960s. One of the primary goals in
the design of the UNIX system was to create an
environment that promoted efficient program
development.
$
$ sed '/UNIX/d' intro Delete all lines containing UNIX
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
environment that promoted efficient program
development.
$
sed '/[Tt]est/d' Delete all lines containing Test or test
sed -n '20,25p' text Print only lines 20 through 25 from text
sed '1,10s/unix/UNIX/g' intro Change unix to UNIX wherever it appears in the first 10 lines of intro
sed '/jan/s/-1/-5/' Change the first -1 to -5 on all lines containing jan
sed 's/...//' data Delete the first three characters from each line of data
sed 's/...$//' data Delete the last 3 characters from each line of data
sed -n 'l' text Print all lines from text, showing nonprinting characters as /nn (where nn is the octal value of the character), and tab characters as /t
$ cat intro
The Unix operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
the design of the Unix system was to create an
environment that promoted efficient program
development.
$
$ sed 's/Unix/UNIX/' intro Substitute Unix with UNIX
The UNIX operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
the design of the UNIX system was to create an
environment that promoted efficient program
development.
$
$ sed -n '1,2p' intro Just print the first 2 lines
The UNIX operating system was pioneered by Ken
Thompson and Dennis Ritchie at Bell Laboratories
$
$ sed -n '/UNIX/p' intro Just print lines containing UNIX
The UNIX operating system was pioneered by Ken
the design of the UNIX system was to create an
$
$ sed '1,2d' intro Delete lines 1 and 2
in the late 1960s. One of the primary goals in
the design of the UNIX system was to create an
environment that promoted efficient program
development.
$
$ sed '/UNIX/d' intro Delete all lines containing UNIX
Thompson and Dennis Ritchie at Bell Laboratories
in the late 1960s. One of the primary goals in
environment that promoted efficient program
development.
$