version 1.42, 2014/05/27 07:00:44 |
version 1.43, 2014/05/27 17:45:02 |
|
|
.El |
.El |
.Sh EXIT STATUS |
.Sh EXIT STATUS |
.Ex -std sed |
.Ex -std sed |
|
.Sh EXAMPLES |
|
The following simulates the |
|
.Xr cat 1 |
|
.Fl s |
|
command, |
|
squeezing excess empty lines from standard input: |
|
.Bd -literal -offset indent |
|
$ sed -n ' |
|
# Write non-empty lines. |
|
/./ { |
|
p |
|
d |
|
} |
|
# Write a single empty line, then look for more empty lines. |
|
/^$/ p |
|
# Get the next line, discard the held <newline> (empty line), |
|
# and look for more empty lines. |
|
:Empty |
|
/^$/ { |
|
N |
|
s/.// |
|
b Empty |
|
} |
|
# Write the non-empty line before going back to search |
|
# for the first in a set of empty lines. |
|
p |
|
\&' |
|
.Ed |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr awk 1 , |
.Xr awk 1 , |
.Xr ed 1 , |
.Xr ed 1 , |