Jump to content

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

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>
 
2,489

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.