<?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>Alex Sleat &#187; remove every other line</title>
	<atom:link href="https://alexsleat.co.uk/tag/remove-every-other-line/feed/" rel="self" type="application/rss+xml" />
	<link>https://alexsleat.co.uk</link>
	<description>/home/alex</description>
	<lastBuildDate>Mon, 25 Jun 2012 11:46:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>HowTo: Remove Every Other Line in Text Files &#8211; Linux</title>
		<link>https://alexsleat.co.uk/2011/04/26/howto-remove-every-other-line-in-text-files-linux/</link>
		<comments>https://alexsleat.co.uk/2011/04/26/howto-remove-every-other-line-in-text-files-linux/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 23:38:57 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[blog1]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[isadora]]></category>
		<category><![CDATA[julia]]></category>
		<category><![CDATA[katya]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux mint]]></category>
		<category><![CDATA[lisa]]></category>
		<category><![CDATA[remove every n line]]></category>
		<category><![CDATA[remove every other line]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[text file]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">https://alexsleat.co.uk/?p=15294</guid>
		<description><![CDATA[<br/><p>Let&#8217;s say you&#8217;ve got a text file, of any size, big or small, and you want to remove every other line of that file, well here are a few commands in Linux that allow you to do this.</p> <p>Example, you want to get from this:</p> 1 2 3 4 5 6 7 8 9 [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Let&#8217;s say you&#8217;ve got a text file, of any size, big or small, and you want to remove every other line of that file, well here are a few commands in Linux that allow you to do this.</p>
<p>Example, you want to get from this:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="nu0">1</span><br />
<span class="nu0">2</span><br />
<span class="nu0">3</span><br />
<span class="nu0">4</span><br />
<span class="nu0">5</span><br />
<span class="nu0">6</span><br />
<span class="nu0">7</span><br />
<span class="nu0">8</span><br />
<span class="nu0">9</span><br />
<span class="nu0">10</span></div>
<p>To this:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="nu0">1</span><br />
<span class="nu0">3</span><br />
<span class="nu0">5</span><br />
<span class="nu0">7</span><br />
<span class="nu0">9</span></div>
<p><strong>The sed way:</strong></p>
<div class="dean_ch" style="white-space: wrap;"> <span class="kw2">sed</span> -n <span class="st0">&quot;p;N;&quot;</span> <span class="kw2">file</span>.txt &gt; newfile.txt</div>
<p><strong>The awk way:</strong></p>
<div class="dean_ch" style="white-space: wrap;"> <span class="kw2">awk</span> <span class="st0">&#8216;NR%2 != 0&#8242;</span> <span class="kw2">file</span>.txt &gt; newfile.txt</div>
<p>Here you can actually specify N lines, replace 2 in the above command and you&#8217;ll be able to take out every N&#8217;th number. As an example, here&#8217;s the above replaced with a 3 on the file:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="nu0">1</span><br />
<span class="nu0">2</span><br />
<span class="nu0">4</span><br />
<span class="nu0">5</span><br />
<span class="nu0">7</span><br />
<span class="nu0">8</span><br />
<span class="nu0">10</span></div>
<p>Easy as pie, right?</p>
]]></content:encoded>
			<wfw:commentRss>https://alexsleat.co.uk/2011/04/26/howto-remove-every-other-line-in-text-files-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
