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 19:59, 15 August 2021
, 2 years ago→{{header|jq}}
m (→{{header|Phix}}: added test comment, added bugfix: strip \r after re-reading from file.) |
|||
Line 126:
saying 'Nice Doggy'
"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>
|