1 |
<!--#include virtual="/server/header.html" --> |
<!--#include virtual="/server/header.html" --> |
2 |
<!-- Parent-Version: 1.79 --> |
<!-- Parent-Version: 1.92 --> |
3 |
|
<!-- This page is derived from /server/standards/boilerplate.html --> |
4 |
<title>GNU sed - GNU Project - Free Software Foundation</title> |
<title>GNU sed - GNU Project - Free Software Foundation</title> |
5 |
|
<link rel="stylesheet" type="text/css" href="sed.css" /> |
6 |
|
<!--#include virtual="/server/gnun/initial-translations-list.html" --> |
7 |
<!--#include virtual="/server/banner.html" --> |
<!--#include virtual="/server/banner.html" --> |
8 |
|
<div class="reduced-width"> |
9 |
|
|
10 |
<h2>GNU sed</h2> |
<h2>GNU sed</h2> |
11 |
|
<hr class="thin" /> |
12 |
|
|
13 |
<p> |
<p> |
14 |
sed (stream editor) isn't an interactive text editor. |
sed (stream editor) is a non-interactive command-line text editor. |
|
Instead, it is used to filter text, i.e., it takes text input, performs |
|
|
some operation (or set of operations) on it, and outputs the modified text. |
|
|
sed is typically used for extracting part of a file using pattern matching |
|
|
or substituting multiple occurrences of a string within a file. |
|
15 |
</p> |
</p> |
16 |
|
<pre class="example"> |
17 |
|
# Example: delete the 4th line in a file |
18 |
|
$ sed '4d' input.txt > output.txt |
19 |
|
|
20 |
|
# Example: replace every occurrence of 'hello' with 'world' on lines 10-20 |
21 |
|
$ sed '10,20s/hello/world/' input.txt > output.txt |
22 |
|
</pre> |
23 |
|
|
24 |
|
<p> |
25 |
|
sed is commonly used to filter text, i.e., it takes text |
26 |
|
input, performs some operation (or set of operations) on it, and |
27 |
|
outputs the modified text. sed is typically used for extracting |
28 |
|
part of a file using pattern matching or substituting multiple |
29 |
|
occurrences of a string within a file. |
30 |
|
</p> |
31 |
|
|
32 |
|
|
33 |
|
<div class="summary"> |
34 |
|
<h3 class="no-display">Table of Contents</h3> |
35 |
|
<ul> |
36 |
|
<li><a href="#help">Getting Help</a></li> |
37 |
|
<li><a href="#download">Downloads</a></li> |
38 |
|
<li><a href="#source">Latest Source</a></li> |
39 |
|
<li><a href="#mailinglists">Mailing Lists</a></li> |
40 |
|
<li><a href="#maintainers">Maintainers</a></li> |
41 |
|
</ul> |
42 |
|
<hr class="no-display" /> |
43 |
|
</div> |
44 |
|
|
45 |
|
|
46 |
|
<h3 id="help">Getting Help</h3> |
47 |
|
|
48 |
|
<ul> |
49 |
|
|
50 |
|
<!-- SED Manual --> |
51 |
|
<li> |
52 |
|
Read the manual locally using <kbd>info sed</kbd> or see the latest |
53 |
|
<a href="manual/">online manual</a>. |
54 |
|
</li> |
55 |
|
|
56 |
|
<!-- Search Mailing lists --> |
57 |
|
<li>Search the archives for previous questions and answers: |
58 |
|
<ul> |
59 |
|
<li>questions, development, and general discussion: |
60 |
|
<a href="https://lists.gnu.org/archive/html/sed-devel/"> |
61 |
|
sed-devel mailing list</a>; |
62 |
|
</li> |
63 |
|
<li>bug reports: |
64 |
|
<a href="https://lists.gnu.org/archive/html/bug-sed/"> |
65 |
|
bug-sed mailing list</a>. |
66 |
|
</li> |
67 |
|
</ul> |
68 |
|
</li> |
69 |
|
|
70 |
|
<!-- http://sed.sf.net --> |
71 |
|
<li>General sed resources are available at |
72 |
|
<a href="http://sed.sf.net">SourceForge.net</a>, including: |
73 |
|
<ul> |
74 |
|
<li> |
75 |
|
<a href="http://sed.sourceforge.net/#docs"> |
76 |
|
documentations, FAQ, one-liners</a>, |
77 |
|
</li> |
78 |
|
<li> |
79 |
|
<a href="http://sed.sourceforge.net/#books"> |
80 |
|
books</a>, and |
81 |
|
</li> |
82 |
|
<li> |
83 |
|
<a href="http://sed.sourceforge.net/#scripts"> |
84 |
|
example scripts</a>. |
85 |
|
</li> |
86 |
|
</ul> |
87 |
|
</li> |
88 |
|
|
89 |
|
|
90 |
|
<!-- http://translationproject.org/domain/sed.html --> |
91 |
|
<li> |
92 |
|
Send translation requests to the language team at the |
93 |
|
<a href="https://translationproject.org/domain/sed.html"> |
94 |
|
Translation Project</a>. |
95 |
|
</li> |
96 |
|
|
97 |
|
<!-- sed-devel@gnu.org for GENERAL QUESTIONS --> |
98 |
|
<li> |
99 |
|
Send general questions or suggestions to the mailing list at |
100 |
|
<<a href="mailto:sed-devel@gnu.org">sed-devel@gnu.org</a>>. |
101 |
|
</li> |
102 |
|
|
103 |
|
<!-- bug-sed@gnu.org for BUG REPORTS --> |
104 |
|
<li> |
105 |
|
Report bugs, including version and distribution variant, to the list at |
106 |
|
<<a href="mailto:bug-sed@gnu.org">bug-sed@gnu.org</a>>.<br/> Before |
107 |
|
sending the bug, please consult the FAQ and mailing list archives |
108 |
|
(above).<br/> Often these perceived bugs are simply due to wrong |
109 |
|
program usage.<br/> To learn more about reporting bugs, |
110 |
|
see <a href="/software/gethelp.html">Getting help with GNU software</a>. |
111 |
|
</li> |
112 |
|
|
113 |
|
</ul> |
114 |
|
|
115 |
|
<h3 id="download">Downloads</h3> |
116 |
|
|
117 |
|
<ul> |
118 |
|
<li><strong>Stable source releases</strong> are available on the main |
119 |
|
GNU download server (<a href="https://ftp.gnu.org/gnu/sed/">HTTPS</a>, |
120 |
|
<a href="http://ftp.gnu.org/gnu/sed/">HTTP</a>, |
121 |
|
<a href="ftp://ftp.gnu.org/gnu/sed/">FTP</a>) and its |
122 |
|
<a href="/prep/ftp.html">mirrors</a>. Please |
123 |
|
<a href="https://ftpmirror.gnu.org/gnu/sed/">use a mirror</a> if possible. |
124 |
|
</li> |
125 |
|
<li>Some test releases can be found on the GNU “alpha” server |
126 |
|
(<a href="https://alpha.gnu.org/gnu/sed/">HTTPS</a>, |
127 |
|
<a href="http://alpha.gnu.org/gnu/sed/">HTTP</a>, |
128 |
|
<a href="ftp://alpha.gnu.org/gnu/sed/">FTP</a>) and its |
129 |
|
<a href="/prep/ftp.html">mirrors</a>. |
130 |
|
</li> |
131 |
|
</ul> |
132 |
|
|
133 |
|
<h3 id="source">Latest Source</h3> |
134 |
|
|
135 |
<p> |
<p> |
136 |
<a href="manual/">Online documentation</a> is available. |
The latest source with revision history can be browsed using |
137 |
|
<a href="https://git.sv.gnu.org/cgit/sed.git">cgit</a> or |
138 |
|
<a href="https://git.sv.gnu.org/gitweb/?p=sed.git">gitweb</a>. |
139 |
|
Assuming you have <a href="https://git-scm.com/">git</a> installed, you |
140 |
|
can retrieve the latest version with this command:</p> |
141 |
|
<pre class="emph-box"> |
142 |
|
<samp>git clone git://git.sv.gnu.org/sed</samp> |
143 |
|
</pre> |
144 |
|
|
145 |
|
<!-- TODO: add README-hacking to SED |
146 |
|
To build from the latest sources please follow the instructions in |
147 |
|
<a href="http://git.savannah.gnu.org/cgit/sed.git/plain/README-hacking">README-hacking</a><br/> |
148 |
|
--> |
149 |
|
|
150 |
|
Please note that we do not suggest using test versions of SED |
151 |
|
for production use. |
152 |
</p> |
</p> |
153 |
|
|
154 |
|
|
155 |
|
<!-- TODO: Add SED to all of the websites below |
156 |
|
<h3 id="testing">Third party testing resources</h3> |
157 |
|
<p> |
158 |
|
<ul> |
159 |
|
<li><a href="http://hydra.nixos.org/jobset/gnu/coreutils-master"> |
160 |
|
Hydra continuous integration jobs</a></li> |
161 |
|
<li><a href="https://scan.coverity.com/projects/29?tab=Overview"> |
162 |
|
Coverity static analysis</a></li> |
163 |
|
<li><a href="http://www.opencoverage.net/coreutils"> |
164 |
|
Open coverage test coverage report</a></li> |
165 |
|
<li><a href="http://hydra.nixos.org/job/gnu/coreutils-master/coverage/latest/log/tail-reload"> |
166 |
|
Latest Hydra test coverage results</a></li> |
167 |
|
</ul> |
168 |
|
</p> |
169 |
|
--> |
170 |
|
|
171 |
|
|
172 |
|
<h3 id="mailinglists">Mailing Lists</h3> |
173 |
|
|
174 |
|
<p> |
175 |
|
You do not need to be subscribed in order to post messages to any GNU |
176 |
|
mailing list. However non-subscribers are moderated by humans so |
177 |
|
please be patient when waiting for your email to arrive. |
178 |
|
</p> |
179 |
|
|
180 |
|
<p> |
181 |
|
You can subscribe to any GNU mailing list via the web as described |
182 |
|
below. Or you can send an empty mail with a <i>Subject:</i> header line of |
183 |
|
just “subscribe” to the relevant <i>-request</i> list. For example, to |
184 |
|
subscribe yourself to the main sed-devel list, you would |
185 |
|
send mail to <<a |
186 |
|
href="mailto:sed-devel-request@gnu.org">sed-devel-request@gnu.org</a>> |
187 |
|
with no body and a <i>Subject:</i> header line of just “subscribe”. |
188 |
|
</p> |
189 |
|
|
190 |
|
<p> |
191 |
|
It has been necessary to moderate the sed mailing lists to prevent the |
192 |
|
flood of spam. Postings to the lists are held for release by |
193 |
|
the list moderator. Sometimes the moderators are unavailable for |
194 |
|
brief periods of time. Please be patient when posting. If you |
195 |
|
don't eventually see the message in the list archive then it did not |
196 |
|
get posted. |
197 |
|
</p> |
198 |
|
|
199 |
|
<dl> |
200 |
|
<dt>Announcements</dt> |
201 |
|
<dd> |
202 |
|
<p> |
203 |
|
Important announcements about GNU sed and most other GNU Software are |
204 |
|
also made on the |
205 |
|
<a href="https://lists.gnu.org/mailman/listinfo/info-gnu"> |
206 |
|
info-gnu@gnu.org mailing list</a>. |
207 |
|
</p> |
208 |
|
</dd> |
209 |
|
|
210 |
|
<dt>Discussion List</dt> |
211 |
|
<dd> |
212 |
|
<p> |
213 |
|
The main discussion list for all things related to GNU sed is |
214 |
|
<a href="https://lists.gnu.org/mailman/listinfo/sed-devel">sed-devel@gnu.org</a>. |
215 |
|
If you have questions, comments, or other general |
216 |
|
discussion about sed then this is the mailing list for that |
217 |
|
discussion. If you don't know where to start then this is the place |
218 |
|
to start. You can browse and search past postings to the |
219 |
|
<a href="https://lists.gnu.org/archive/html/sed-devel/">sed-devel archive</a>. |
220 |
|
</p> |
221 |
|
</dd> |
222 |
|
|
223 |
|
<dt>Bug Reports</dt> |
224 |
|
<dd> |
225 |
|
<p> |
226 |
|
If you think you have found a bug in GNU sed, then please send |
227 |
|
as complete a bug report as possible to |
228 |
|
<a href="https://lists.gnu.org/mailman/listinfo/bug-sed">bug-sed@gnu.org</a>, |
229 |
|
and it will automatically be entered into the <a href="https://debbugs.gnu.org/sed"> |
230 |
|
sed bug tracker</a>. |
231 |
|
<!-- TODO: sed FAQ? |
232 |
|
Before reporting bugs please read the <a href="faq/coreutils-faq.html">FAQ</a>. |
233 |
|
--> |
234 |
|
A very useful and often referenced guide on how to write bug reports |
235 |
|
and ask good questions is the document |
236 |
|
<a href="http://www.catb.org/~esr/faqs/smart-questions.html"> |
237 |
|
How To Ask Questions The Smart Way</a>. |
238 |
|
You can browse previous postings and search the |
239 |
|
<a href="https://lists.gnu.org/archive/html/bug-sed/">bug-sed archive</a>. |
240 |
|
</p> |
241 |
|
</dd> |
242 |
|
|
243 |
|
<dt>Enhancement Requests</dt> |
244 |
|
<dd> |
245 |
|
<p> |
246 |
|
If you would like any new feature to be included in future versions of |
247 |
|
sed, please send a request to <a |
248 |
|
href="https://lists.gnu.org/mailman/listinfo/sed-devel">sed-devel@gnu.org</a>. |
249 |
|
|
250 |
|
This is the general discussion list and a good place to start |
251 |
|
discussion of a new feature. After consideration you may be asked to |
252 |
|
log a request into the bug tracker so that the issue is not lost. |
253 |
|
|
254 |
|
If you would like to implement yourself, then note that non trivial changes |
255 |
|
require copyright assignment to the FSF as detailed in the “Copyright Assignment” |
256 |
|
<!-- TODO: add HACKING to sed --> |
257 |
|
section of GNU coreutils <a href="https://git.sv.gnu.org/cgit/coreutils.git/plain/HACKING">HACKING</a> notes. |
258 |
|
</p> |
259 |
|
</dd> |
260 |
|
|
261 |
|
<dt>Mailing List Etiquette</dt> |
262 |
|
<dd> |
263 |
|
<p> |
264 |
|
Please do not send messages encoded as HTML nor encoded as base64 MIME |
265 |
|
nor included as multiple formats. |
266 |
|
Please send messages as |
267 |
|
<a href="https://web.archive.org/web/20160305050159/http://stagecraft.theprices.net/nomime.html"> |
268 |
|
plain text</a>. |
269 |
|
Please include a descriptive subject line. If all of the subjects are |
270 |
|
<em>bug</em> then it is impossible to differentiate them. |
271 |
|
Please avoid sending large messages, such as log files, system call |
272 |
|
trace output, and other content resulting in messages over about 40 kB, |
273 |
|
to the mailing lists without prior contact. Those are best sent |
274 |
|
directly to those requesting that information after initial contact. |
275 |
|
</p> |
276 |
|
|
277 |
|
<p> |
278 |
|
Please remember that development of GNU sed is a volunteer effort, and you |
279 |
|
can also contribute to its development. For information about contributing |
280 |
|
to the GNU Project, please read <a href="/help/">How to help GNU</a>. |
281 |
|
</p> |
282 |
|
</dd> |
283 |
|
</dl> |
284 |
|
|
285 |
|
<h3 id="maintainers">Maintainers</h3> |
286 |
|
|
287 |
|
<p> |
288 |
|
GNU sed is currently being maintained by |
289 |
|
Jim Meyering <<a href="mailto:jim@meyering.net">jim@meyering.net</a>>, |
290 |
|
and |
291 |
|
Assaf Gordon <<a href="mailto:assafgordon@gmail.com">assafgordon@gmail.com</a>>. |
292 |
|
</p> |
293 |
|
|
294 |
|
|
295 |
|
</div> |
296 |
</div><!-- for id="content", starts in the include above --> |
</div><!-- for id="content", starts in the include above --> |
297 |
<!--#include virtual="/server/footer.html" --> |
<!--#include virtual="/server/footer.html" --> |
298 |
<div id="footer"> |
<div id="footer"> |
304 |
the FSF. Broken links and other corrections or suggestions can be sent |
the FSF. Broken links and other corrections or suggestions can be sent |
305 |
to <a href="mailto:sed-devel@gnu.org"><em>sed-devel@gnu.org</em></a>. |
to <a href="mailto:sed-devel@gnu.org"><em>sed-devel@gnu.org</em></a>. |
306 |
</p> |
</p> |
307 |
|
|
308 |
|
<p>Please see the <a |
309 |
|
href="/server/standards/README.translations.html">Translations |
310 |
|
README</a> for information on coordinating and contributing translations |
311 |
|
of this article.</p> |
312 |
</div> |
</div> |
313 |
|
|
314 |
<!-- Regarding copyright, in general, standalone pages (as opposed to |
<!-- Regarding copyright, in general, standalone pages (as opposed to |
318 |
Please make sure the copyright date is consistent with the |
Please make sure the copyright date is consistent with the |
319 |
document. For web pages, it is ok to list just the latest year the |
document. For web pages, it is ok to list just the latest year the |
320 |
document was modified, or published. |
document was modified, or published. |
321 |
|
|
322 |
If you wish to list earlier years, that is ok too. |
If you wish to list earlier years, that is ok too. |
323 |
Either "2001, 2002, 2003" or "2001-2003" are ok for specifying |
Either "2001, 2002, 2003" or "2001-2003" are ok for specifying |
324 |
years, as long as each year in the range is in fact a copyrightable |
years, as long as each year in the range is in fact a copyrightable |
325 |
year, i.e., a year in which the document was published (including |
year, i.e., a year in which the document was published (including |
326 |
being publicly visible on the web or in a revision control system). |
being publicly visible on the web or in a revision control system). |
327 |
|
|
328 |
There is more detail about copyright years in the GNU Maintainers |
There is more detail about copyright years in the GNU Maintainers |
329 |
Information document, www.gnu.org/prep/maintain. --> |
Information document, www.gnu.org/prep/maintain. --> |
330 |
|
|
331 |
<p>Copyright © 2013, 2014 Free Software Foundation, Inc.</p> |
<p>Copyright © 2013, 2014, 2015, 2016 Free Software Foundation, Inc.</p> |
332 |
|
|
333 |
<p>This page is licensed under a <a rel="license" |
<p>This page is licensed under a <a rel="license" |
334 |
href="http://creativecommons.org/licenses/by-nd/4.0/">Creative |
href="http://creativecommons.org/licenses/by-nd/4.0/">Creative |