Reverse the order of lines in a text file while preserving the contents of each line: Difference between revisions
Content added Content deleted
m (added a comment (in the task's preamble) about superfluous blanks.) |
mNo edit summary |
||
Line 20: | Line 20: | ||
Also, don't include the rightmost informative comments (◄■■■■■■), as they are not meant to be part of the file. |
Also, don't include the rightmost informative comments (◄■■■■■■), as they are not meant to be part of the file. |
||
<br><br> |
<br><br> |
||
=={{header|Julia}}== |
|||
The optional <pre>keep</pre> argument to <pre>readlines</pre> means to keep the newline char at the end of each line. The <pre>|></pre> |
|||
symbolism is the pipe operator. and the <pre>.|></pre> symbolism means to pipe each line in the read array to print separately. |
|||
<lang julia>readlines("diplomacyrodgers.txt", keep=true) |> reverse .|> print</lang>{{output}} |
|||
<pre> |
|||
--- Will Rodgers |
|||
until you can find a rock." |
|||
saying 'Nice Doggy' |
|||
"Diplomacy is the art of |
|||
</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |