Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions
Reverse the order of lines in a text file while preserving the contents of each line (view source)
Revision as of 19:55, 6 April 2023
, 1 year ago→{{header|Ruby}}: Add Ruby
(add OCaml) |
(→{{header|Ruby}}: Add Ruby) |
||
Line 797:
</pre>
=={{header|Ruby}}==
<syntaxhighlight lang="ruby">puts File.readlines("diplomacy.txt").reverse</syntaxhighlight>
{{out}}
<pre> --- Will Rodgers
until you can find a rock."
saying 'Nice Doggy'
"Diplomacy is the art of
</pre>
=={{header|sed}}==
<syntaxhighlight lang="sed">1!G
Line 811 ⟶ 820:
</pre>
=={{header|UNIX Shell}}==
|