<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TLF Blog &#187; Shell Programming</title>
	<atom:link href="http://www.thelinuxfix.com/blog/category/shell-programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thelinuxfix.com/blog</link>
	<description>Updates from the trenches of The Linux Fix</description>
	<lastBuildDate>Thu, 05 Nov 2009 18:41:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding a line to the beginning of a file in Unix/Linux</title>
		<link>http://www.thelinuxfix.com/blog/2009/11/05/adding-a-line-to-the-beginning-of-a-file-in-unixlinux/</link>
		<comments>http://www.thelinuxfix.com/blog/2009/11/05/adding-a-line-to-the-beginning-of-a-file-in-unixlinux/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 18:41:03 +0000</pubDate>
		<dc:creator>brian</dc:creator>
				<category><![CDATA[Shell Programming]]></category>

		<guid isPermaLink="false">http://www.thelinuxfix.com/blog/?p=50</guid>
		<description><![CDATA[This morning someone asked me how to do a relatively simple operation from a Unix shell: Adding a line of text to the beginning of a file.
Much to my surprise he asked for help with amazingly complex methods he had tried.
Okay everyone, no need to hit this thumbtack with a sledgehammer!  Let&#8217;s say you have [...]]]></description>
			<content:encoded><![CDATA[<p>This morning someone asked me how to do a relatively simple operation from a Unix shell: <strong>Adding a line of text to the beginning of a file.</strong></p>
<p>Much to my surprise he asked for help with <a href="http://www.unix.com/shell-programming-scripting/6744-sed-insert-text-top-file.html">amazingly</a> <a href="http://archives.devshed.com/forums/unix-linux-135/insert-line-in-the-first-line-372253.html">complex</a> <a href="http://www.unix.com/shell-programming-scripting/12313-append-cat-beginning-file.html">methods</a> he had tried.</p>
<p>Okay everyone, no need to hit this thumbtack with a sledgehammer!  Let&#8217;s say you have a file &#8220;textfile.txt&#8221; and want to put &#8220;&lt;Header&gt;&#8221; on the top:</p>
<p>echo -e &#8220;&lt;Header&gt;\n$(cat textfile.txt)&#8221; &gt; textfile.txt</p>
<p>There you go, nice and simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thelinuxfix.com/blog/2009/11/05/adding-a-line-to-the-beginning-of-a-file-in-unixlinux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
