
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.thelinuxwiki.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.thelinuxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Handy_sed_one_liners</id>
		<title>Handy sed one liners - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.thelinuxwiki.com/index.php?action=history&amp;feed=atom&amp;title=Handy_sed_one_liners"/>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;action=history"/>
		<updated>2026-04-29T00:24:29Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.21.5</generator>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=984&amp;oldid=prev</id>
		<title>Nighthawk: /* print section of file between two regular expressions (inclusive) */</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=984&amp;oldid=prev"/>
				<updated>2016-05-08T16:14:49Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;print section of file between two regular expressions (inclusive)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:14, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed '/baz/!s/foo/bar/g'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed '/baz/!s/foo/bar/g'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==print section of file between two regular expressions (inclusive)==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/ins&gt;==print section of file between two regular expressions (inclusive)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==FILE SPACING==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==FILE SPACING==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=983&amp;oldid=prev</id>
		<title>Nighthawk at 16:14, 8 May 2016</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=983&amp;oldid=prev"/>
				<updated>2016-05-08T16:14:25Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:14, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 23:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; EXCEPT for lines which contain &amp;quot;baz&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; EXCEPT for lines which contain &amp;quot;baz&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed '/baz/!s/foo/bar/g'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed '/baz/!s/foo/bar/g'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==print section of file between two regular expressions (inclusive)==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=982&amp;oldid=prev</id>
		<title>Nighthawk: /* SELECTIVE PRINTING OF CERTAIN LINES */</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=982&amp;oldid=prev"/>
				<updated>2016-05-08T16:13:18Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;SELECTIVE PRINTING OF CERTAIN LINES&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:13, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 215:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 215:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; gsed -n '3~7p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # GNU sed only&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; gsed -n '3~7p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # GNU sed only&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '3,${p;n;n;n;n;n;n;}' # other seds&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '3,${p;n;n;n;n;n;n;}' # other seds&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; # print section of file between two regular expressions (inclusive)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==SELECTIVE DELETION OF CERTAIN LINES==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==SELECTIVE DELETION OF CERTAIN LINES==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=981&amp;oldid=prev</id>
		<title>Nighthawk at 16:10, 8 May 2016</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=981&amp;oldid=prev"/>
				<updated>2016-05-08T16:10:01Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:10, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 55:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '$='&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '$='&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;TEXT CONVERSION AND SUBSTITUTION&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;TEXT CONVERSION AND SUBSTITUTION&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=980&amp;oldid=prev</id>
		<title>Nighthawk at 16:08, 8 May 2016</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=980&amp;oldid=prev"/>
				<updated>2016-05-08T16:08:54Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:08, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.student.northpark.edu/pemente/sed/sed1line.txt&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.student.northpark.edu/pemente/sed/sed1line.txt&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.cornerstonemag.com/sed/sed1line.txt&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.cornerstonemag.com/sed/sed1line.txt&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;This file is also available in Portuguese at:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160;  http://www.lrv.ufsc.br/wmaker/sed_ptBR.html&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==most popular==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==most popular==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=979&amp;oldid=prev</id>
		<title>Nighthawk at 16:08, 8 May 2016</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=979&amp;oldid=prev"/>
				<updated>2016-05-08T16:08:28Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr style='vertical-align: top;'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 16:08, 8 May 2016&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 9:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.lrv.ufsc.br/wmaker/sed_ptBR.html&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160;  http://www.lrv.ufsc.br/wmaker/sed_ptBR.html&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;FILE SPACING&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==most popular==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;===search and replace===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; # substitute (find and replace) &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; on each line&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed 's/foo/bar/'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # replaces only 1st instance in a line&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed 's/foo/bar/4'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replaces only 4th instance in a line&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed 's/foo/bar/g'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replaces ALL instances in a line&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed 's/\(.*\)foo/\1bar/'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replace only the last case&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; ONLY for lines which contain &amp;quot;baz&amp;quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed '/baz/s/foo/bar/g'&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; EXCEPT for lines which contain &amp;quot;baz&amp;quot;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt; sed '/baz/!s/foo/bar/g'&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;FILE SPACING&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # double space a file&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # double space a file&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 101:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed&amp;#160; -e :a -e 's/^.\{1,77\}$/ &amp;amp;/;ta' -e 's/\( *\)\1/\1/'&amp;#160; # method 2&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed&amp;#160; -e :a -e 's/^.\{1,77\}$/ &amp;amp;/;ta' -e 's/\( *\)\1/\1/'&amp;#160; # method 2&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; # substitute (find and replace) &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; on each line&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed 's/foo/bar/'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # replaces only 1st instance in a line&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed 's/foo/bar/4'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replaces only 4th instance in a line&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed 's/foo/bar/g'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replaces ALL instances in a line&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed 's/\(.*\)foo/\1bar/'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; # replace only the last case&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; ONLY for lines which contain &amp;quot;baz&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed '/baz/s/foo/bar/g'&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; EXCEPT for lines which contain &amp;quot;baz&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; sed '/baz/!s/foo/bar/g'&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # change &amp;quot;scarlet&amp;quot; or &amp;quot;ruby&amp;quot; or &amp;quot;puce&amp;quot; to &amp;quot;red&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # change &amp;quot;scarlet&amp;quot; or &amp;quot;ruby&amp;quot; or &amp;quot;puce&amp;quot; to &amp;quot;red&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 130:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 135:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed 'n;n;n;n;G;'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # other seds&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed 'n;n;n;n;G;'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # other seds&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;SELECTIVE PRINTING OF CERTAIN LINES&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;SELECTIVE PRINTING OF CERTAIN LINES&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # print first 10 lines of file (emulates behavior of &amp;quot;head&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # print first 10 lines of file (emulates behavior of &amp;quot;head&amp;quot;)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 215:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 220:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/Iowa/,/Montana/p'&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;  # case sensitive&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;SELECTIVE DELETION OF CERTAIN LINES&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;SELECTIVE DELETION OF CERTAIN LINES&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # print all of file EXCEPT section between 2 regular expressions&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # print all of file EXCEPT section between 2 regular expressions&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 267:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 272:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/^$/{p;h;};/./{x;/./p;}'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; sed -n '/^$/{p;h;};/./{x;/./p;}'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;SPECIAL APPLICATIONS&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;:&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;SPECIAL APPLICATIONS&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # remove nroff overstrikes (char, backspace) from man pages. The 'echo'&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; # remove nroff overstrikes (char, backspace) from man pages. The 'echo'&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	<entry>
		<id>http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=178&amp;oldid=prev</id>
		<title>Nighthawk: Pushed from Themanclub.</title>
		<link rel="alternate" type="text/html" href="http://www.thelinuxwiki.com/index.php?title=Handy_sed_one_liners&amp;diff=178&amp;oldid=prev"/>
				<updated>2013-04-12T15:41:42Z</updated>
		
		<summary type="html">&lt;p&gt;Pushed from Themanclub.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Handy one-liners for SED&lt;br /&gt;
&lt;br /&gt;
HANDY ONE-LINERS FOR SED (Unix stream editor)               Mar. 23, 2001&lt;br /&gt;
compiled by Eric Pement &amp;lt;pemente@northpark.edu&amp;gt;               version 5.1&lt;br /&gt;
Latest version of this file is usually at:&lt;br /&gt;
   http://www.student.northpark.edu/pemente/sed/sed1line.txt&lt;br /&gt;
   http://www.cornerstonemag.com/sed/sed1line.txt&lt;br /&gt;
This file is also available in Portuguese at:&lt;br /&gt;
   http://www.lrv.ufsc.br/wmaker/sed_ptBR.html&lt;br /&gt;
&lt;br /&gt;
FILE SPACING:&lt;br /&gt;
&lt;br /&gt;
 # double space a file&lt;br /&gt;
 sed G&lt;br /&gt;
&lt;br /&gt;
 # double space a file which already has blank lines in it. Output file&lt;br /&gt;
 # should contain no more than one blank line between lines of text.&lt;br /&gt;
 sed '/^$/d;G'&lt;br /&gt;
&lt;br /&gt;
 # triple space a file&lt;br /&gt;
 sed 'G;G'&lt;br /&gt;
&lt;br /&gt;
 # undo double-spacing (assumes even-numbered lines are always blank)&lt;br /&gt;
 sed 'n;d'&lt;br /&gt;
&lt;br /&gt;
NUMBERING:&lt;br /&gt;
&lt;br /&gt;
 # number each line of a file (simple left alignment). Using a tab (see&lt;br /&gt;
 # note on '\t' at end of file) instead of space will preserve margins.&lt;br /&gt;
 sed = filename | sed 'N;s/\n/\t/'&lt;br /&gt;
&lt;br /&gt;
 # number each line of a file (number on left, right-aligned)&lt;br /&gt;
 sed = filename | sed 'N; s/^/     /; s/ *\(.\{6,\}\)\n/\1  /'&lt;br /&gt;
&lt;br /&gt;
 # number each line of file, but only print numbers if line is not blank&lt;br /&gt;
 sed '/./=' filename | sed '/./N; s/\n/ /'&lt;br /&gt;
&lt;br /&gt;
 # count lines (emulates &amp;quot;wc -l&amp;quot;)&lt;br /&gt;
 sed -n '$='&lt;br /&gt;
&lt;br /&gt;
TEXT CONVERSION AND SUBSTITUTION:&lt;br /&gt;
&lt;br /&gt;
 # IN UNIX ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt;
 sed 's/.$//'               # assumes that all lines end with CR/LF&lt;br /&gt;
 sed 's/^M$//'              # in bash/tcsh, press Ctrl-V then Ctrl-M&lt;br /&gt;
 sed 's/\x0D$//'            # gsed 3.02.80, but top script is easier&lt;br /&gt;
&lt;br /&gt;
 # IN UNIX ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;
 sed &amp;quot;s/$/`echo -e \\\r`/&amp;quot;            # command line under ksh&lt;br /&gt;
 sed 's/$'&amp;quot;/`echo \\\r`/&amp;quot;             # command line under bash&lt;br /&gt;
 sed &amp;quot;s/$/`echo \\\r`/&amp;quot;               # command line under zsh&lt;br /&gt;
 sed 's/$/\r/'                        # gsed 3.02.80&lt;br /&gt;
&lt;br /&gt;
 # IN DOS ENVIRONMENT: convert Unix newlines (LF) to DOS format&lt;br /&gt;
 sed &amp;quot;s/$//&amp;quot;                          # method 1&lt;br /&gt;
 sed -n p                             # method 2&lt;br /&gt;
&lt;br /&gt;
 # IN DOS ENVIRONMENT: convert DOS newlines (CR/LF) to Unix format&lt;br /&gt;
 # Cannot be done with DOS versions of sed. Use &amp;quot;tr&amp;quot; instead.&lt;br /&gt;
 tr -d \r &amp;lt;infile &amp;gt;outfile            # GNU tr version 1.22 or higher&lt;br /&gt;
&lt;br /&gt;
 # delete leading whitespace (spaces, tabs) from front of each line&lt;br /&gt;
 # aligns all text flush left&lt;br /&gt;
 sed 's/^[ \t]*//'                    # see note on '\t' at end of file&lt;br /&gt;
&lt;br /&gt;
 # delete trailing whitespace (spaces, tabs) from end of each line&lt;br /&gt;
 sed 's/[ \t]*$//'                    # see note on '\t' at end of file&lt;br /&gt;
&lt;br /&gt;
 # delete BOTH leading and trailing whitespace from each line&lt;br /&gt;
 sed 's/^[ \t]*//;s/[ \t]*$//'&lt;br /&gt;
&lt;br /&gt;
 # insert 5 blank spaces at beginning of each line (make page offset)&lt;br /&gt;
 sed 's/^/     /'&lt;br /&gt;
&lt;br /&gt;
 # align all text flush right on a 79-column width&lt;br /&gt;
 sed -e :a -e 's/^.\{1,78\}$/ &amp;amp;/;ta'  # set at 78 plus 1 space&lt;br /&gt;
&lt;br /&gt;
 # center all text in the middle of 79-column width. In method 1,&lt;br /&gt;
 # spaces at the beginning of the line are significant, and trailing&lt;br /&gt;
 # spaces are appended at the end of the line. In method 2, spaces at&lt;br /&gt;
 # the beginning of the line are discarded in centering the line, and&lt;br /&gt;
 # no trailing spaces appear at the end of lines.&lt;br /&gt;
 sed  -e :a -e 's/^.\{1,77\}$/ &amp;amp; /;ta'                     # method 1&lt;br /&gt;
 sed  -e :a -e 's/^.\{1,77\}$/ &amp;amp;/;ta' -e 's/\( *\)\1/\1/'  # method 2&lt;br /&gt;
&lt;br /&gt;
 # substitute (find and replace) &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; on each line&lt;br /&gt;
 sed 's/foo/bar/'             # replaces only 1st instance in a line&lt;br /&gt;
 sed 's/foo/bar/4'            # replaces only 4th instance in a line&lt;br /&gt;
 sed 's/foo/bar/g'            # replaces ALL instances in a line&lt;br /&gt;
 sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case&lt;br /&gt;
 sed 's/\(.*\)foo/\1bar/'            # replace only the last case&lt;br /&gt;
&lt;br /&gt;
 # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; ONLY for lines which contain &amp;quot;baz&amp;quot;&lt;br /&gt;
 sed '/baz/s/foo/bar/g'&lt;br /&gt;
&lt;br /&gt;
 # substitute &amp;quot;foo&amp;quot; with &amp;quot;bar&amp;quot; EXCEPT for lines which contain &amp;quot;baz&amp;quot;&lt;br /&gt;
 sed '/baz/!s/foo/bar/g'&lt;br /&gt;
&lt;br /&gt;
 # change &amp;quot;scarlet&amp;quot; or &amp;quot;ruby&amp;quot; or &amp;quot;puce&amp;quot; to &amp;quot;red&amp;quot;&lt;br /&gt;
 sed 's/scarlet/red/g;s/ruby/red/g;s/puce/red/g'   # most seds&lt;br /&gt;
 gsed 's/scarlet\|ruby\|puce/red/g'                # GNU sed only&lt;br /&gt;
&lt;br /&gt;
 # reverse order of lines (emulates &amp;quot;tac&amp;quot;)&lt;br /&gt;
 # bug/feature in HHsed v1.5 causes blank lines to be deleted&lt;br /&gt;
 sed '1!G;h;$!d'               # method 1&lt;br /&gt;
 sed -n '1!G;h;$p'             # method 2&lt;br /&gt;
&lt;br /&gt;
 # reverse each character on the line (emulates &amp;quot;rev&amp;quot;)&lt;br /&gt;
 sed '/\n/!G;s/\(.\)\(.*\n\)/&amp;amp;\2\1/;//D;s/.//'&lt;br /&gt;
&lt;br /&gt;
 # join pairs of lines side-by-side (like &amp;quot;paste&amp;quot;)&lt;br /&gt;
 sed '$!N;s/\n/ /'&lt;br /&gt;
&lt;br /&gt;
 # if a line ends with a backslash, append the next line to it&lt;br /&gt;
 sed -e :a -e '/\\$/N; s/\\\n//; ta'&lt;br /&gt;
&lt;br /&gt;
 # if a line begins with an equal sign, append it to the previous line&lt;br /&gt;
 # and replace the &amp;quot;=&amp;quot; with a single space&lt;br /&gt;
 sed -e :a -e '$!N;s/\n=/ /;ta' -e 'P;D'&lt;br /&gt;
&lt;br /&gt;
 # add commas to numeric strings, changing &amp;quot;1234567&amp;quot; to &amp;quot;1,234,567&amp;quot;&lt;br /&gt;
 gsed ':a;s/\B[0-9]\{3\}\&amp;gt;/,&amp;amp;/;ta'                     # GNU sed&lt;br /&gt;
 sed -e :a -e 's/\(.*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta'  # other seds&lt;br /&gt;
&lt;br /&gt;
 # add commas to numbers with decimal points and minus signs (GNU sed)&lt;br /&gt;
 gsed ':a;s/\(^\|[^0-9.]\)\([0-9]\+\)\([0-9]\{3\}\)/\1\2,\3/g;ta'&lt;br /&gt;
&lt;br /&gt;
 # add a blank line every 5 lines (after lines 5, 10, 15, 20, etc.)&lt;br /&gt;
 gsed '0~5G'                  # GNU sed only&lt;br /&gt;
 sed 'n;n;n;n;G;'             # other seds&lt;br /&gt;
&lt;br /&gt;
SELECTIVE PRINTING OF CERTAIN LINES:&lt;br /&gt;
&lt;br /&gt;
 # print first 10 lines of file (emulates behavior of &amp;quot;head&amp;quot;)&lt;br /&gt;
 sed 10q&lt;br /&gt;
&lt;br /&gt;
 # print first line of file (emulates &amp;quot;head -1&amp;quot;)&lt;br /&gt;
 sed q&lt;br /&gt;
&lt;br /&gt;
 # print the last 10 lines of a file (emulates &amp;quot;tail&amp;quot;)&lt;br /&gt;
 sed -e :a -e '$q;N;11,$D;ba'&lt;br /&gt;
&lt;br /&gt;
 # print the last 2 lines of a file (emulates &amp;quot;tail -2&amp;quot;)&lt;br /&gt;
 sed '$!N;$!D'&lt;br /&gt;
&lt;br /&gt;
 # print the last line of a file (emulates &amp;quot;tail -1&amp;quot;)&lt;br /&gt;
 sed '$!d'                    # method 1&lt;br /&gt;
 sed -n '$p'                  # method 2&lt;br /&gt;
&lt;br /&gt;
 # print only lines which match regular expression (emulates &amp;quot;grep&amp;quot;)&lt;br /&gt;
 sed -n '/regexp/p'           # method 1&lt;br /&gt;
 sed '/regexp/!d'             # method 2&lt;br /&gt;
&lt;br /&gt;
 # print only lines which do NOT match regexp (emulates &amp;quot;grep -v&amp;quot;)&lt;br /&gt;
 sed -n '/regexp/!p'          # method 1, corresponds to above&lt;br /&gt;
 sed '/regexp/d'              # method 2, simpler syntax&lt;br /&gt;
&lt;br /&gt;
 # print the line immediately before a regexp, but not the line&lt;br /&gt;
 # containing the regexp&lt;br /&gt;
 sed -n '/regexp/{g;1!p;};h'&lt;br /&gt;
&lt;br /&gt;
 # print the line immediately after a regexp, but not the line&lt;br /&gt;
 # containing the regexp&lt;br /&gt;
 sed -n '/regexp/{n;p;}'&lt;br /&gt;
&lt;br /&gt;
 # print 1 line of context before and after regexp, with line number&lt;br /&gt;
 # indicating where the regexp occurred (similar to &amp;quot;grep -A1 -B1&amp;quot;)&lt;br /&gt;
 sed -n -e '/regexp/{=;x;1!p;g;$!N;p;D;}' -e h&lt;br /&gt;
&lt;br /&gt;
 # grep for AAA and BBB and CCC (in any order)&lt;br /&gt;
 sed '/AAA/!d; /BBB/!d; /CCC/!d'&lt;br /&gt;
&lt;br /&gt;
 # grep for AAA and BBB and CCC (in that order)&lt;br /&gt;
 sed '/AAA.*BBB.*CCC/!d'&lt;br /&gt;
&lt;br /&gt;
 # grep for AAA or BBB or CCC (emulates &amp;quot;egrep&amp;quot;)&lt;br /&gt;
 sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d    # most seds&lt;br /&gt;
 gsed '/AAA\|BBB\|CCC/!d'                        # GNU sed only&lt;br /&gt;
&lt;br /&gt;
 # print paragraph if it contains AAA (blank lines separate paragraphs)&lt;br /&gt;
 # HHsed v1.5 must insert a 'G;' after 'x;' in the next 3 scripts below&lt;br /&gt;
 sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;'&lt;br /&gt;
&lt;br /&gt;
 # print paragraph if it contains AAA and BBB and CCC (in any order)&lt;br /&gt;
 sed -e '/./{H;$!d;}' -e 'x;/AAA/!d;/BBB/!d;/CCC/!d'&lt;br /&gt;
&lt;br /&gt;
 # print paragraph if it contains AAA or BBB or CCC&lt;br /&gt;
 sed -e '/./{H;$!d;}' -e 'x;/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d&lt;br /&gt;
 gsed '/./{H;$!d;};x;/AAA\|BBB\|CCC/b;d'         # GNU sed only&lt;br /&gt;
&lt;br /&gt;
 # print only lines of 65 characters or longer&lt;br /&gt;
 sed -n '/^.\{65\}/p'&lt;br /&gt;
&lt;br /&gt;
 # print only lines of less than 65 characters&lt;br /&gt;
 sed -n '/^.\{65\}/!p'        # method 1, corresponds to above&lt;br /&gt;
 sed '/^.\{65\}/d'            # method 2, simpler syntax&lt;br /&gt;
&lt;br /&gt;
 # print section of file from regular expression to end of file&lt;br /&gt;
 sed -n '/regexp/,$p'&lt;br /&gt;
&lt;br /&gt;
 # print section of file based on line numbers (lines 8-12, inclusive)&lt;br /&gt;
 sed -n '8,12p'               # method 1&lt;br /&gt;
 sed '8,12!d'                 # method 2&lt;br /&gt;
&lt;br /&gt;
 # print line number 52&lt;br /&gt;
 sed -n '52p'                 # method 1&lt;br /&gt;
 sed '52!d'                   # method 2&lt;br /&gt;
 sed '52q;d'                  # method 3, efficient on large files&lt;br /&gt;
&lt;br /&gt;
 # beginning at line 3, print every 7th line&lt;br /&gt;
 gsed -n '3~7p'               # GNU sed only&lt;br /&gt;
 sed -n '3,${p;n;n;n;n;n;n;}' # other seds&lt;br /&gt;
&lt;br /&gt;
 # print section of file between two regular expressions (inclusive)&lt;br /&gt;
 sed -n '/Iowa/,/Montana/p'             # case sensitive&lt;br /&gt;
&lt;br /&gt;
SELECTIVE DELETION OF CERTAIN LINES:&lt;br /&gt;
&lt;br /&gt;
 # print all of file EXCEPT section between 2 regular expressions&lt;br /&gt;
 sed '/Iowa/,/Montana/d'&lt;br /&gt;
&lt;br /&gt;
 # delete duplicate, consecutive lines from a file (emulates &amp;quot;uniq&amp;quot;).&lt;br /&gt;
 # First line in a set of duplicate lines is kept, rest are deleted.&lt;br /&gt;
 sed '$!N; /^\(.*\)\n\1$/!P; D'&lt;br /&gt;
&lt;br /&gt;
 # delete duplicate, nonconsecutive lines from a file. Beware not to&lt;br /&gt;
 # overflow the buffer size of the hold space, or else use GNU sed.&lt;br /&gt;
 sed -n 'G; s/\n/&amp;amp;&amp;amp;/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'&lt;br /&gt;
&lt;br /&gt;
 # delete the first 10 lines of a file&lt;br /&gt;
 sed '1,10d'&lt;br /&gt;
&lt;br /&gt;
 # delete the last line of a file&lt;br /&gt;
 sed '$d'&lt;br /&gt;
&lt;br /&gt;
 # delete the last 2 lines of a file&lt;br /&gt;
 sed 'N;$!P;$!D;$d'&lt;br /&gt;
&lt;br /&gt;
 # delete the last 10 lines of a file&lt;br /&gt;
 sed -e :a -e '$d;N;2,10ba' -e 'P;D'   # method 1&lt;br /&gt;
 sed -n -e :a -e '1,10!{P;N;D;};N;ba'  # method 2&lt;br /&gt;
&lt;br /&gt;
 # delete every 8th line&lt;br /&gt;
 gsed '0~8d'                           # GNU sed only&lt;br /&gt;
 sed 'n;n;n;n;n;n;n;d;'                # other seds&lt;br /&gt;
&lt;br /&gt;
 # delete ALL blank lines from a file (same as &amp;quot;grep '.' &amp;quot;)&lt;br /&gt;
 sed '/^$/d'                           # method 1&lt;br /&gt;
 sed '/./!d'                           # method 2&lt;br /&gt;
&lt;br /&gt;
 # delete all CONSECUTIVE blank lines from file except the first; also&lt;br /&gt;
 # deletes all blank lines from top and end of file (emulates &amp;quot;cat -s&amp;quot;)&lt;br /&gt;
 sed '/./,/^$/!d'          # method 1, allows 0 blanks at top, 1 at EOF&lt;br /&gt;
 sed '/^$/N;/\n$/D'        # method 2, allows 1 blank at top, 0 at EOF&lt;br /&gt;
&lt;br /&gt;
 # delete all CONSECUTIVE blank lines from file except the first 2:&lt;br /&gt;
 sed '/^$/N;/\n$/N;//D'&lt;br /&gt;
&lt;br /&gt;
 # delete all leading blank lines at top of file&lt;br /&gt;
 sed '/./,$!d'&lt;br /&gt;
&lt;br /&gt;
 # delete all trailing blank lines at end of file&lt;br /&gt;
 sed -e :a -e '/^\n*$/{$d;N;ba' -e '}'  # works on all seds&lt;br /&gt;
 sed -e :a -e '/^\n*$/N;/\n$/ba'        # ditto, except for gsed 3.02*&lt;br /&gt;
&lt;br /&gt;
 # delete the last line of each paragraph&lt;br /&gt;
 sed -n '/^$/{p;h;};/./{x;/./p;}'&lt;br /&gt;
&lt;br /&gt;
SPECIAL APPLICATIONS:&lt;br /&gt;
&lt;br /&gt;
 # remove nroff overstrikes (char, backspace) from man pages. The 'echo'&lt;br /&gt;
 # command may need an -e switch if you use Unix System V or bash shell.&lt;br /&gt;
 sed &amp;quot;s/.`echo \\\b`//g&amp;quot;    # double quotes required for Unix environment&lt;br /&gt;
 sed 's/.^H//g'             # in bash/tcsh, press Ctrl-V and then Ctrl-H&lt;br /&gt;
 sed 's/.\x08//g'           # hex expression for sed v1.5&lt;br /&gt;
&lt;br /&gt;
 # get Usenet/e-mail message header&lt;br /&gt;
 sed '/^$/q'                # deletes everything after first blank line&lt;br /&gt;
&lt;br /&gt;
 # get Usenet/e-mail message body&lt;br /&gt;
 sed '1,/^$/d'              # deletes everything up to first blank line&lt;br /&gt;
&lt;br /&gt;
 # get Subject header, but remove initial &amp;quot;Subject: &amp;quot; portion&lt;br /&gt;
 sed '/^Subject: */!d; s///;q'&lt;br /&gt;
&lt;br /&gt;
 # get return address header&lt;br /&gt;
 sed '/^Reply-To:/q; /^From:/h; /./d;g;q'&lt;br /&gt;
&lt;br /&gt;
 # parse out the address proper. Pulls out the e-mail address by itself&lt;br /&gt;
 # from the 1-line return address header (see preceding script)&lt;br /&gt;
 sed 's/ *(.*)//; s/&amp;gt;.*//; s/.*[:&amp;lt;] *//'&lt;br /&gt;
&lt;br /&gt;
 # add a leading angle bracket and space to each line (quote a message)&lt;br /&gt;
 sed 's/^/&amp;gt; /'&lt;br /&gt;
&lt;br /&gt;
 # delete leading angle bracket &amp;amp; space from each line (unquote a message)&lt;br /&gt;
 sed 's/^&amp;gt; //'&lt;br /&gt;
&lt;br /&gt;
 # remove most HTML tags (accommodates multiple-line tags)&lt;br /&gt;
 sed -e :a -e 's/&amp;lt;[^&amp;gt;]*&amp;gt;//g;/&amp;lt;/N;//ba'&lt;br /&gt;
&lt;br /&gt;
 # extract multi-part uuencoded binaries, removing extraneous header&lt;br /&gt;
 # info, so that only the uuencoded portion remains. Files passed to&lt;br /&gt;
 # sed must be passed in the proper order. Version 1 can be entered&lt;br /&gt;
 # from the command line; version 2 can be made into an executable&lt;br /&gt;
 # Unix shell script. (Modified from a script by Rahul Dhesi.)&lt;br /&gt;
 sed '/^end/,/^begin/d' file1 file2 ... fileX | uudecode   # vers. 1&lt;br /&gt;
 sed '/^end/,/^begin/d' &amp;quot;$@&amp;quot; | uudecode                    # vers. 2&lt;br /&gt;
&lt;br /&gt;
 # zip up each .TXT file individually, deleting the source file and&lt;br /&gt;
 # setting the name of each .ZIP file to the basename of the .TXT file&lt;br /&gt;
 # (under DOS: the &amp;quot;dir /b&amp;quot; switch returns bare filenames in all caps).&lt;br /&gt;
 echo @echo off &amp;gt;zipup.bat&lt;br /&gt;
 dir /b *.txt | sed &amp;quot;s/^\(.*\)\.TXT/pkzip -mo \1 \1.TXT/&amp;quot; &amp;gt;&amp;gt;zipup.bat&lt;br /&gt;
&lt;br /&gt;
TYPICAL USE: Sed takes one or more editing commands and applies all of&lt;br /&gt;
them, in sequence, to each line of input. After all the commands have&lt;br /&gt;
been applied to the first input line, that line is output and a second&lt;br /&gt;
input line is taken for processing, and the cycle repeats. The&lt;br /&gt;
preceding examples assume that input comes from the standard input&lt;br /&gt;
device (i.e, the console, normally this will be piped input). One or&lt;br /&gt;
more filenames can be appended to the command line if the input does&lt;br /&gt;
not come from stdin. Output is sent to stdout (the screen). Thus:&lt;br /&gt;
&lt;br /&gt;
 cat filename | sed '10q'        # uses piped input&lt;br /&gt;
 sed '10q' filename              # same effect, avoids a useless &amp;quot;cat&amp;quot;&lt;br /&gt;
 sed '10q' filename &amp;gt; newfile    # redirects output to disk&lt;br /&gt;
&lt;br /&gt;
For additional syntax instructions, including the way to apply editing&lt;br /&gt;
commands from a disk file instead of the command line, consult &amp;quot;sed &amp;amp;&lt;br /&gt;
awk, 2nd Edition,&amp;quot; by Dale Dougherty and Arnold Robbins (O'Reilly,&lt;br /&gt;
1997; http://www.ora.com), &amp;quot;UNIX Text Processing,&amp;quot; by Dale Dougherty&lt;br /&gt;
and Tim O'Reilly (Hayden Books, 1987) or the tutorials by Mike Arst&lt;br /&gt;
distributed in U-SEDIT2.ZIP (many sites). To fully exploit the power&lt;br /&gt;
of sed, one must understand &amp;quot;regular expressions.&amp;quot; For this, see&lt;br /&gt;
&amp;quot;Mastering Regular Expressions&amp;quot; by Jeffrey Friedl (O'Reilly, 1997).&lt;br /&gt;
The manual (&amp;quot;man&amp;quot;) pages on Unix systems may be helpful (try &amp;quot;man&lt;br /&gt;
sed&amp;quot;, &amp;quot;man regexp&amp;quot;, or the subsection on regular expressions in &amp;quot;man&lt;br /&gt;
ed&amp;quot;), but man pages are notoriously difficult. They are not written to&lt;br /&gt;
teach sed use or regexps to first-time users, but as a reference text&lt;br /&gt;
for those already acquainted with these tools.&lt;br /&gt;
&lt;br /&gt;
QUOTING SYNTAX: The preceding examples use single quotes ('...')&lt;br /&gt;
instead of double quotes (&amp;quot;...&amp;quot;) to enclose editing commands, since&lt;br /&gt;
sed is typically used on a Unix platform. Single quotes prevent the&lt;br /&gt;
Unix shell from intrepreting the dollar sign ($) and backquotes&lt;br /&gt;
(`...`), which are expanded by the shell if they are enclosed in&lt;br /&gt;
double quotes. Users of the &amp;quot;csh&amp;quot; shell and derivatives will also need&lt;br /&gt;
to quote the exclamation mark (!) with the backslash (i.e., \!) to&lt;br /&gt;
properly run the examples listed above, even within single quotes.&lt;br /&gt;
Versions of sed written for DOS invariably require double quotes&lt;br /&gt;
(&amp;quot;...&amp;quot;) instead of single quotes to enclose editing commands.&lt;br /&gt;
&lt;br /&gt;
USE OF '\t' IN SED SCRIPTS: For clarity in documentation, we have used&lt;br /&gt;
the expression '\t' to indicate a tab character (0x09) in the scripts.&lt;br /&gt;
However, most versions of sed do not recognize the '\t' abbreviation,&lt;br /&gt;
so when typing these scripts from the command line, you should press&lt;br /&gt;
the TAB key instead. '\t' is supported as a regular expression&lt;br /&gt;
metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80.&lt;br /&gt;
&lt;br /&gt;
VERSIONS OF SED: Versions of sed do differ, and some slight syntax&lt;br /&gt;
variation is to be expected. In particular, most do not support the&lt;br /&gt;
use of labels (:name) or branch instructions (b,t) within editing&lt;br /&gt;
commands, except at the end of those commands. We have used the syntax&lt;br /&gt;
which will be portable to most users of sed, even though the popular&lt;br /&gt;
GNU versions of sed allow a more succinct syntax. When the reader sees&lt;br /&gt;
a fairly long command such as this:&lt;br /&gt;
&lt;br /&gt;
   sed -e '/AAA/b' -e '/BBB/b' -e '/CCC/b' -e d&lt;br /&gt;
&lt;br /&gt;
it is heartening to know that GNU sed will let you reduce it to:&lt;br /&gt;
&lt;br /&gt;
   sed '/AAA/b;/BBB/b;/CCC/b;d'      # or even&lt;br /&gt;
   sed '/AAA\|BBB\|CCC/b;d'&lt;br /&gt;
&lt;br /&gt;
In addition, remember that while many versions of sed accept a command&lt;br /&gt;
like &amp;quot;/one/ s/RE1/RE2/&amp;quot;, some do NOT allow &amp;quot;/one/! s/RE1/RE2/&amp;quot;, which&lt;br /&gt;
contains space before the 's'. Omit the space when typing the command.&lt;br /&gt;
&lt;br /&gt;
OPTIMIZING FOR SPEED: If execution speed needs to be increased (due to&lt;br /&gt;
large input files or slow processors or hard disks), substitution will&lt;br /&gt;
be executed more quickly if the &amp;quot;find&amp;quot; expression is specified before&lt;br /&gt;
giving the &amp;quot;s/.../.../&amp;quot; instruction. Thus:&lt;br /&gt;
&lt;br /&gt;
   sed 's/foo/bar/g' filename         # standard replace command&lt;br /&gt;
   sed '/foo/ s/foo/bar/g' filename   # executes more quickly&lt;br /&gt;
   sed '/foo/ s//bar/g' filename      # shorthand sed syntax&lt;br /&gt;
&lt;br /&gt;
On line selection or deletion in which you only need to output lines&lt;br /&gt;
from the first part of the file, a &amp;quot;quit&amp;quot; command (q) in the script&lt;br /&gt;
will drastically reduce processing time for large files. Thus:&lt;br /&gt;
&lt;br /&gt;
   sed -n '45,50p' filename           # print line nos. 45-50 of a file&lt;br /&gt;
   sed -n '51q;45,50p' filename       # same, but executes much faster&lt;br /&gt;
&lt;br /&gt;
If you have any additional scripts to contribute or if you find errors&lt;br /&gt;
in this document, please send e-mail to the compiler. Indicate the&lt;br /&gt;
version of sed you used, the operating system it was compiled for, and&lt;br /&gt;
the nature of the problem. Various scripts in this file were written&lt;br /&gt;
or contributed by:&lt;br /&gt;
&lt;br /&gt;
 Al Aab &amp;lt;af137@freenet.toronto.on.ca&amp;gt;   # &amp;quot;seders&amp;quot; list moderator&lt;br /&gt;
 Edgar Allen &amp;lt;era@sky.net&amp;gt;              # various&lt;br /&gt;
 Yiorgos Adamopoulos &amp;lt;adamo@softlab.ece.ntua.gr&amp;gt;&lt;br /&gt;
 Dale Dougherty &amp;lt;dale@songline.com&amp;gt;     # author of &amp;quot;sed &amp;amp; awk&amp;quot;&lt;br /&gt;
 Carlos Duarte &amp;lt;cdua@algos.inesc.pt&amp;gt;    # author of &amp;quot;do it with sed&amp;quot;&lt;br /&gt;
 Eric Pement &amp;lt;pemente@northpark.edu&amp;gt;    # author of this document&lt;br /&gt;
 Ken Pizzini &amp;lt;ken@halcyon.com&amp;gt;          # author of GNU sed v3.02&lt;br /&gt;
 S.G. Ravenhall &amp;lt;stew.ravenhall@totalise.co.uk&amp;gt; # great de-html script&lt;br /&gt;
 Greg Ubben &amp;lt;gsu@romulus.ncsc.mil&amp;gt;      # many contributions &amp;amp; much help&lt;br /&gt;
&lt;br /&gt;
tpl@eng.cam.ac.uk&lt;br /&gt;
&lt;br /&gt;
[[category:linux]]&lt;/div&gt;</summary>
		<author><name>Nighthawk</name></author>	</entry>

	</feed>