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