<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Utils on slightlymore</title><link>https://slightlymore.co.uk/tags/utils/</link><description>Recent content in Utils on slightlymore</description><generator>Hugo</generator><language>en-GB</language><copyright>&lt;a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license"&gt;CC BY 4.0&lt;/a&gt; by Clinton Montague</copyright><lastBuildDate>Mon, 06 Apr 2026 12:11:16 +0100</lastBuildDate><atom:link href="https://slightlymore.co.uk/tags/utils/index.xml" rel="self" type="application/rss+xml"/><item><title>Reverse the order of lines in a file</title><link>https://slightlymore.co.uk/reverse-the-order-of-lines-in-a-file/</link><pubDate>Mon, 06 Apr 2026 00:00:00 +0000</pubDate><guid>https://slightlymore.co.uk/reverse-the-order-of-lines-in-a-file/</guid><description>&lt;p&gt;Reading and writing to the same file can in theory cause it to become truncated or corrupted so you can use &lt;code&gt;sponge&lt;/code&gt; from &lt;code&gt;moreutils&lt;/code&gt; to &amp;ldquo;soak up std out and write to a file&amp;rdquo; which ensures that the file is processed in entirety before redirecting the output back to the same file.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;tail -r file.txt &lt;span class="p"&gt;|&lt;/span&gt; sponge file.txt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item></channel></rss>