Filter: Difference between revisions

Content added Content deleted
(Add ed example)
Line 1,541: Line 1,541:
→ (0 2 4 6 8 10 12 14 16 18 20 22)
→ (0 2 4 6 8 10 12 14 16 18 20 22)


</syntaxhighlight>

=={{header|Ed}}==
All even numbers end in 0, 2, 4, 6, or 8. So only choose and print the even ones. Implies that input is a set of decimal numbers separated by newlines.
<syntaxhighlight>
H
g/[02468]$/p
Q
</syntaxhighlight>

A destructive alternative might be: take all the numbers and remove all odds (ending in 1, 3, 5, 7, or 9).

<syntaxhighlight>
H
g/[13579]$/d
,p
Q
</syntaxhighlight>
</syntaxhighlight>