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