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 04:33, 4 August 2021
, 2 years ago→{{header|Julia}}: documentation
m (CalmoSoft moved page Reverse file lines to Display the order of the lines of a file in reverse order) |
m (→{{header|Julia}}: documentation) |
||
Line 90:
=={{header|Julia}}==
The optional <pre>keep</pre> argument to <pre>readlines</pre> means to keep the newline '\n' char or '\r\n' digraph 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}}
|