Strip control codes and extended characters from a string: Difference between revisions

Content added Content deleted
(Add ed example)
 
Line 887: Line 887:
print strip "\tHellö world"
print strip "\tHellö world"
</syntaxhighlight>
</syntaxhighlight>

=={{header|ed}}==

Uses POSIX control character class.

<syntaxhighlight lang="sed">
H
,l
g/.*/s/[[:cntrl:]]//g
,p
Q
</syntaxhighlight>

{{out}}

<pre>$ cat control-chars.ed | ed -lEGs control-chars.input
abc\r
\b\adef\177
abc
def</pre>


=={{header|Erlang}}==
=={{header|Erlang}}==