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

Content added Content deleted
m (→‎{{header|Phix}}: added test comment, added bugfix: strip \r after re-reading from file.)
Line 126: Line 126:
saying 'Nice Doggy'
saying 'Nice Doggy'
"Diplomacy is the art of
"Diplomacy is the art of
</pre>

=={{header|jq}}==
{{works with|jq}}
'''Works with gojq, the Go implementation of jq'''
<lang sh>
jq -nRr '[inputs] | reverse[]' input.txt
</lang>
{{out}}
<pre>
--- Will Rodgers

until you can find a rock."
saying 'Nice Doggy'
"Diplomacy is the art of
</pre>
</pre>