NIL.Dd November 29, 2018
.Dt "Show trailing spaces using ed"
This second fun-tip article will explain how to display trailing
spaces in a text file, using the
.Lk https://man.openbsd.org/ed ed(1)
editor.
ed has a special command for showing a dollar character at the end of
each line, which mean that if the line has some spaces, the dollar
character will spaced from the last visible line character.
.Bd -literal -offset indent
$ echo ",pl" | ed some-file.txt
453
.Dd November 29, 2018$
.Dt "Show trailing spaces using ed"$
This second fun-tip article will explain how to display trailing$
spaces in a text file, using the$
.Lk https://man.openbsd.org/ed ed(1)$
editor.$
ed has a special command for showing a dollar character at the end of$
each line, which mean that if the line has some spaces, the dollar$
character will spaced from the last visible line character.$
$
&.Bd -literal -offset indent$
$ echo ",pl" | ed some-file.txt$
.Ed
This is the output of the article file while I am writing it. As you
can notice, there is no trailing space here.
The first number shown in the ed output is the file size, because ed
starts at the end of the file and then, wait for commands.
If I use that very same command on a small text files with trailing
spaces, the following result is expected:
.Bd -literal -offset indent
49
this is full $
of trailing $
spaces ! $
.Ed
It is also possible to display line numbers using the "n" command
instead of the "p" command.
This would produce this result for my current article file:
.Bd -literal -offset indent
1559
1 .Dd November 29, 2018$
2 .Dt "Show trailing spaces using ed"$
3 This second fun-tip article will explain how to display trailing$
4 spaces in a text file, using the$
5 .Lk https://man.openbsd.org/ed ed(1)$
6 editor.$
7 ed has a special command for showing a dollar character at the end\
of$
8 each line, which mean that if the line has some spaces, the dollar$
9 character will spaced from the last visible line character.$
10 $
11 .Bd -literal -offset indent$
12 $ echo ",pl" | ed some-file.txt$
13 453$
14 .Dd November 29, 2018$$
15 .Dt "Show trailing spaces using ed"$$
16 This second fun-tip article will explain how to display trailing\
$$
17 spaces in a text file, using the$$
18 .Lk https://man.openbsd.org/ed ed(1)$$
19 editor.$$
20 ed has a special command for showing a '\$' character at the e\
nd of$$
21 each line, which mean that if the line has some spaces, the '\$\
'$$
22 character will spaced from the last visible line character.$$
23 $$
24 \&.Bd \-literal \-offset indent$$
25 \$ echo ",pl" | ed some-file.txt$$
26 .Ed$
27 $
28 This is the output of the article file while I am writing it. As\
you$
29 can notice, there is no trailing space here.$
30 $
31 The first number shown in the ed output is the file size, becaus\
e ed$
32 starts at the end of the file and then, wait for commands.$
33 $
34 If I use that very same command on a small text files with trail\
ing$
35 spaces, the following result is expected:$
36 $
37 .Bd -literal -offset indent$
38 49$
39 this is full $$
40 of trailing $$
41 spaces ! $$
42 .Ed$
43 $
44 It is also possible to display line numbers using the "n" comman\
d$
45 instead of the "p" command.$
46 This would produce this result for my current article file:$
47 .Bd -literal -offset indent$
.Ed
This shows my article file with each line numbered plus the position
of the last character of each line, this is awesome!
I have to admit though that including my own article as example is
blowing up my mind, especially as I am writing it using ed.
text/gemini
This content has been proxied by September (ba2dc).