1. GENERAL INFORMATION
1.1. Introduction - How this FAQ is organized
This FAQ is organized to answer common (and some uncommon) questions about sed, quickly. If you see a term or abbreviation in the examples that seems unclear, see if the term is defined in section 1.5. If not, send your comment to pemente[at]northpark.edu.
1.2. Latest version of the sed FAQ
The newest version of the sed FAQ is usually here:
http://sed.sourceforge.net/sedfaq.html (HTML version) http://sed.sourceforge.net/sedfaq.txt (plain text) http://www.student.northpark.edu/pemente/sed/sedfaq.html http://www.student.northpark.edu/pemente/sed/sedfaq.txt http://www.faqs.org/faqs/editor-faq/sed ftp://rtfm.mit.edu/pub/faqs/editor-faq/sed
Another FAQ file on sed by a different author can be found here:
1.3. FAQ revision information
In the plaintext version, changes are shown by a vertical bar (|) placed in column 78 of the affected lines. To remove the vertical bars (use double quotes for MS-DOS):
sed 's/ *|$//' sedfaq.txt > sedfaq2.txt
In the HTML version, vertical bars do not appear. New or altered portions of the FAQ are indicated by printing in dark blue type.
In the text version, words needing emphasis may be surrounded by the underscore '_' or the asterisk '*'. In the HTML version, these are changed to italics and boldface, respectively.
1.4. How do I add a question/answer to the sed FAQ?
Word your question briefly and send it to pemente[at]northpark.edu, indicating your proposed change. We'll post it on the sed-users mailing list (see section 2.3.2) and discuss it there. If it's good, your contribution will be added to the next edition.
1.5. FAQ abbreviations
files = one or more filenames, separated by whitespace gsed = GNU sed ssed = super-sed RE = Regular Expressions supported by sed LHS = the left-hand side ("find" part) of "s/find/repl/" command RHS = the right-hand side ("replace" part) of "s/find/repl/" cmd nn+ = version nn or higher (e.g., "15+" = version 1.5 and above)
files: "files" stands for one or more filenames entered on the command line. The names may include any wildcards your shell understands (such as ``zork*'' or ``Aug[4-9].let''). Sed will process each filename passed to it by the shell.
RE: For details on regular expressions, see section 3.1.1., below.
1.6. Credits and acknowledgements
Many of the ideas for this FAQ were taken from the Awk FAQ:
and from the old Perl FAQ:
The following individuals have contributed significantly to this document, and have provided input and wording suggestions for questions, answers, and script examples. Credit goes to these contributors (in alphabetical order by last name):
Al Aab, Yiorgos Adamopoulos, Paolo Bonzini, Walter Briscoe, Jim Dennis, Carlos Duarte, Otavio Exel, Sven Guckes, Aurelio Jargas, Mark Katz, Toby Kelsey, Eric Pement, Greg Pfeiffer, Ken Pizzini, Niall Smart, Simon Taylor, Peter Tillier, Greg Ubben, Laurent Vogel.
1.7. Standard disclaimers
While a serious attempt has been made to ensure the accuracy of the information presented herein, the contributors and maintainers of this document do not claim the absence of errors and make no warranties on the information provided. If you notice any mistakes, please let us know so we can fix it.
Other Stuff On This Site
Emacs for Vi Programmers