<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: How to Add Text to the Beginning of File in Linux	</title>
	<atom:link href="https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/</link>
	<description>UbuntuMint - Everything About Ubuntu Linux</description>
	<lastBuildDate>Fri, 25 Aug 2023 04:00:57 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
	<item>
		<title>
		By: Rick Romig		</title>
		<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-37</link>

		<dc:creator><![CDATA[Rick Romig]]></dc:creator>
		<pubDate>Wed, 03 Mar 2021 22:40:35 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=767#comment-37</guid>

					<description><![CDATA[I tested the &lt;strong&gt;echo&lt;/strong&gt; and &lt;strong&gt;cat&lt;/strong&gt; examples but could only get it to sort of work by using back-ticks instead of single quotes when assigning the x variable. The resulting file had all of the new-line characters removed and displayed it on a single line.

I test this in bash on Linux Mint 20.1.]]></description>
			<content:encoded><![CDATA[<p>I tested the <strong>echo</strong> and <strong>cat</strong> examples but could only get it to sort of work by using back-ticks instead of single quotes when assigning the x variable. The resulting file had all of the new-line characters removed and displayed it on a single line.</p>
<p>I test this in bash on Linux Mint 20.1.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Abhilash Mhaisne		</title>
		<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-20</link>

		<dc:creator><![CDATA[Abhilash Mhaisne]]></dc:creator>
		<pubDate>Mon, 08 Feb 2021 06:18:31 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=767#comment-20</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-15&quot;&gt;Rick Stanley&lt;/a&gt;.

Hi Rick,

Thanks for the suggestion. We will include a note to advise the user to backup the file first.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-15">Rick Stanley</a>.</p>
<p>Hi Rick,</p>
<p>Thanks for the suggestion. We will include a note to advise the user to backup the file first.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Abhilash Mhaisne		</title>
		<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-19</link>

		<dc:creator><![CDATA[Abhilash Mhaisne]]></dc:creator>
		<pubDate>Mon, 08 Feb 2021 06:17:43 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=767#comment-19</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-13&quot;&gt;Michael&lt;/a&gt;.

Hi Michael,

You are right, there could be a limit on the size of variables. We will include this in the article.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-13">Michael</a>.</p>
<p>Hi Michael,</p>
<p>You are right, there could be a limit on the size of variables. We will include this in the article.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Rick Stanley		</title>
		<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-15</link>

		<dc:creator><![CDATA[Rick Stanley]]></dc:creator>
		<pubDate>Sun, 07 Feb 2021 14:31:26 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=767#comment-15</guid>

					<description><![CDATA[A better and safer solution:
&lt;ol&gt;
&lt;li&gt;Create a new temp file.&lt;/li&gt;
&lt;li&gt;Write the new text to the start of the new temp file.&lt;/li&gt; 
&lt;li&gt;Append the full text from the original file to the new temp file.&lt;/li&gt;
&lt;li&gt;Delete the original file, or better still, rename the original file to a backup filename.&lt;/li&gt;
&lt;li&gt;Rename the temp filename to the original filename.&lt;/li&gt;
&lt;/ol&gt;
Sometimes safety is better than efficiency.  If any errors occurred, with the examples you posted, you could lose the entire original file.  Especially when you failed to advise the reader to back up the original file before performing the &quot;&lt;strong&gt;insert&lt;/strong&gt;&quot; directly into the original file!]]></description>
			<content:encoded><![CDATA[<p>A better and safer solution:</p>
<ol>
<li>Create a new temp file.</li>
<li>Write the new text to the start of the new temp file.</li>
<li>Append the full text from the original file to the new temp file.</li>
<li>Delete the original file, or better still, rename the original file to a backup filename.</li>
<li>Rename the temp filename to the original filename.</li>
</ol>
<p>Sometimes safety is better than efficiency.  If any errors occurred, with the examples you posted, you could lose the entire original file.  Especially when you failed to advise the reader to back up the original file before performing the &#8220;<strong>insert</strong>&#8221; directly into the original file!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Michael		</title>
		<link>https://www.ubuntumint.com/add-text-to-beginning-of-file-in-linux/#comment-13</link>

		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Fri, 05 Feb 2021 20:29:17 +0000</pubDate>
		<guid isPermaLink="false">https://www.ubuntumint.com/?p=767#comment-13</guid>

					<description><![CDATA[The first variant has a limit on the file size and that limit could be much smaller than the file system&#039;s limit on file size.

We can&#039;t store unlimited data in the variables. I think you should mention it.]]></description>
			<content:encoded><![CDATA[<p>The first variant has a limit on the file size and that limit could be much smaller than the file system&#8217;s limit on file size.</p>
<p>We can&#8217;t store unlimited data in the variables. I think you should mention it.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
