Jump to content

Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions

(add OCaml)
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}}==
1,149

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.