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

Added R.
(Added R.)
Line 275:
"Diplomacy is the art of
</pre>
 
=={{header|R}}==
<lang R>text <- scan("Rodgers.txt", character(), sep = "\n")
print(text)
reversed <- rev(text)
print(reversed)
write(reversed, "SaveTheOutput.txt")</lang>
{{out}}
<pre>Read 5 items
[1] " \"Diplomacy is the art of"
[2] " saying 'Nice Doggy'"
[3] "until you can find a rock.\""
[4] " "
[5] " --- Will Rodgers"
[1] " --- Will Rodgers"
[2] " "
[3] "until you can find a rock.\""
[4] " saying 'Nice Doggy'"
[5] " \"Diplomacy is the art of" </pre>
 
=={{header|Raku}}==
331

edits