N'th: Difference between revisions

765 bytes added ,  3 days ago
Add ed example
m (fix typo)
(Add ed example)
Line 2,284:
1000th 1001st 1002nd 1003rd 1004th 1005th 1006th 1007th 1008th 1009th 1010th 1011th 1012th 1013th 1014th 1015th 1016th 1017th 1018th 1019th 1020th 1021st 1022nd 1023rd 1024th 1025th
</pre>
 
=={{header|ed}}==
 
<syntaxhighlight lang="sed">
H
# Special case: 10-19
g/1[0-9]$/s//&'th/
g/1$/s//&'st/
g/2$/s//&'nd/
g/3$/s//&'rd/
g/[0-9]$/s//&'th/
# Join by spaces, purely for aesthetics.
g/.*/s//& /
,j
,p
Q
</syntaxhighlight>
 
{{out}}
 
<pre>$ ed -s nth.input < nth.ed
Newline appended
0'th 1'st 2'nd 3'rd 4'th 5'th 6'th 7'th 8'th 9'th 10'th 11'th 12'th 13'th 14'th 15'th 16'th 17'th 18'th 19'th 20'th 21'st 22'nd 23'rd 24'th 25'th 250'th 251'st 252'nd 253'rd 254'th 255'th 256'th 257'th 258'th 259'th 260'th 261'st 262'nd 263'rd 264'th 265'th 1000'th 1001'st 1002'nd 1003'rd 1004'th 1005'th 1006'th 1007'th 1008'th 1009'th 1010'th 1011'th 1012'th 1013'th 1014'th 1015'th 1016'th 1017'th 1018'th 1019'th 1020'th 1021'st 1022'nd 1023'rd 1024'th 1025'th </pre>
 
=={{header|Elena}}==
110

edits