<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.r00tedvw.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.r00tedvw.com/index.php?action=history&amp;feed=atom&amp;title=Ubuntu%2FCommands%2Fsed</id>
		<title>Ubuntu/Commands/sed - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.r00tedvw.com/index.php?action=history&amp;feed=atom&amp;title=Ubuntu%2FCommands%2Fsed"/>
		<link rel="alternate" type="text/html" href="https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;action=history"/>
		<updated>2026-11-16T20:00:43Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1676&amp;oldid=prev</id>
		<title>R00t: /* Extra */</title>
		<link rel="alternate" type="text/html" href="https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1676&amp;oldid=prev"/>
				<updated>2017-11-13T20:07:48Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Extra&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 valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:07, 13 November 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; perl -wne'while(/[\w\.]+@[\w\.]+/g){print &amp;quot;$&amp;amp;\n&amp;quot;}' test.txt&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160; perl -wne'while(/[\w\.]+@[\w\.]+/g){print &amp;quot;$&amp;amp;\n&amp;quot;}' test.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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The above should find all email addresses within a text file, regardless of where they exist.&amp;#160; It does assume there will be a word boundary before and after the email address.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The above should find all email addresses within a text file, regardless of where they exist.&amp;#160; It does assume there will be a word boundary before and after the email address.&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;br&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;Add a comma to the end of every line except the last one&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt; &amp;lt;nowiki&amp;gt;sed -i '$!s/$/,/' test.txt&amp;lt;/nowiki&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code&amp;gt;$!&amp;lt;/code&amp;gt; means every line except the last.&amp;lt;br&amp;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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;code&amp;gt;$&amp;lt;/code&amp;gt; matches the end of every line&amp;lt;br&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>R00t</name></author>	</entry>

	<entry>
		<id>https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1675&amp;oldid=prev</id>
		<title>R00t at 18:57, 13 November 2017</title>
		<link rel="alternate" type="text/html" href="https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1675&amp;oldid=prev"/>
				<updated>2017-11-13T18:57:46Z</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 valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 18:57, 13 November 2017&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&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;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Ubuntu/Commands|Commands]] | [[Ubuntu/Commands/dig|dig]] | [[Ubuntu/Commands/Mail_Server_CLI|Mail Server CLI]] | [[Ubuntu/Commands/Mail_Server_CLI/openssl|openssl]] | [[Ubuntu/Commands/sed|sed]]&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==sed==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;==sed==&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sed&amp;#160; is&amp;#160; a&amp;#160; stream editor.&amp;#160; A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).&amp;#160; While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient.&amp;#160; But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Sed&amp;#160; is&amp;#160; a&amp;#160; stream editor.&amp;#160; A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).&amp;#160; While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient.&amp;#160; But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>R00t</name></author>	</entry>

	<entry>
		<id>https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1674&amp;oldid=prev</id>
		<title>R00t: Created page with &quot;==sed== Sed  is  a  stream editor.  A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).  While in some ways sim...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.r00tedvw.com/index.php?title=Ubuntu/Commands/sed&amp;diff=1674&amp;oldid=prev"/>
				<updated>2017-11-13T18:57:06Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;==sed== Sed  is  a  stream editor.  A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).  While in some ways sim...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==sed==&lt;br /&gt;
Sed  is  a  stream editor.  A stream editor is used to perform basic text transformations on an input stream (a file or input from a pipeline).  While in some ways similar to an editor which permits scripted edits (such as ed), sed works by making only one pass over the input(s), and is consequently more efficient.  But it is sed's ability to filter text in a pipeline which particularly distinguishes it from other types of editors.&lt;br /&gt;
&lt;br /&gt;
==Command Syntax==&lt;br /&gt;
;-e&lt;br /&gt;
:adds a script or regular expression pattern&lt;br /&gt;
;-i&lt;br /&gt;
:edits files in place (makes backup if extension supplied)&lt;br /&gt;
;s/regexp/replacment/&lt;br /&gt;
:Attempt to match regexp against the pattern space.  If successful, replace  that  portion  matched  with replacement. The replacement may contain the special character &amp;amp; to refer to that portion of the pattern space which matched, and the special escapes \1 through \9 to refer to the  corresponding  matching sub-expressions in the regexp.&lt;br /&gt;
;/g&lt;br /&gt;
:global, meaning that the match will apply to as many matches on the line as available, instead of just the first&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
Looks for the pattern &amp;quot;Length&amp;quot; and everything after that (greedy match) and replaces it with a whitespace&lt;br /&gt;
 sed -i 's/Length.*/ /g' TrillianLogFile_Highlighted2.CSV&lt;br /&gt;
Inserts a new line after every line into file test&lt;br /&gt;
 sed -i -e 's/.*/\&lt;br /&gt;
 &amp;amp;/' test&lt;br /&gt;
Append a new line with specific text after every line&lt;br /&gt;
 sed '/.*/a\test' test&lt;br /&gt;
Add new text to the beginning of each line&lt;br /&gt;
 sed 's/^/| /g' test&lt;br /&gt;
&lt;br /&gt;
==Extra==&lt;br /&gt;
Finding all email addresses in a text file using Perl.  While not related to sed, this is the best section for documentation of it for.&lt;br /&gt;
 perl -wne'while(/[\w\.]+@[\w\.]+/g){print &amp;quot;$&amp;amp;\n&amp;quot;}' test.txt&lt;br /&gt;
The above should find all email addresses within a text file, regardless of where they exist.  It does assume there will be a word boundary before and after the email address.&lt;/div&gt;</summary>
		<author><name>R00t</name></author>	</entry>

	</feed>