allanswers.org - sed FAQ, version 014

 Home >  Softwareeditor-faq >

sed FAQ, version 014

Section 1 of 5 - Prev - Next
All sections - 1 - 2 - 3 - 4 - 5


Archive-name: editor-faq/sed
Posting-Frequency: bimonthly
Last-modified: 2000/04/28
Version: 014
URL: http://www.cornerstonemag.com/sed/sedfaq.html
Maintainer: Eric Pement 

                             THE SED FAQ

                  Frequently Asked Questions about
                       sed, the stream editor

CONTENTS:

1. GENERAL INFORMATION
1.1. Introduction - How this FAQ is organized
1.2. Latest version of the sed FAQ
1.3. FAQ revision information
1.4. How do I add a question/answer to the sed FAQ?
1.5. FAQ abbreviations
1.6. Credits and acknowledgements
1.7. Standard disclaimers

2. BASIC SED
2.1. What is sed?
2.2. What versions of sed are there, and where can I get them?

2.2.1. Free versions

 2.2.1.1. Unix platforms
 2.2.1.2. OS/2
 2.2.1.3. Microsoft Windows (Win3x, Win9x, WinNT, Win2K)
 2.2.1.4. MS-DOS
 2.2.1.5. CP/M

2.2.2. Shareware and Commercial versions

 2.2.2.1. Unix platforms
 2.2.2.2. OS/2
 2.2.2.3. Windows 95/98, Windows NT, Windows 2000
 2.2.2.4. MS-DOS

2.3. Where can I learn to use sed?

 2.3.1. Books
 2.3.2. Mailing list
 2.3.3. Tutorials, electronic text
 2.3.4. General web and ftp sites

3. TECHNICAL
3.1. More detailed explanation of basic sed
3.2. Common one-line sed scripts. How do I . . . ?

      - double/triple-space a file?
      - convert DOS/Unix newlines?
      - delete leading/trailing spaces?
      - do substitutions on all/certain lines?
      - delete consecutive blank lines?
      - delete blank lines at the top/end of the file?

3.3. Addressing and address ranges
3.4. [reserved]
3.5. [reserved]
3.6. Notes about s2p, the sed-to-perl translator
3.7. GNU/POSIX extensions to regular expressions

4. EXAMPLES
4.1. How do I perform a case-insensitive search?
4.2. How do I make changes in only part of a file?
4.3. How do I change only the first occurrence of a pattern?
4.4. How do I make substitutions in every file in a directory, or in a
     complete directory tree?

 4.4.1 - Perl solution
 4.4.2 - Unix solution
 4.4.3 - DOS solution

4.5. How do I parse a comma-delimited data file?
4.6. How do I insert a newline into the RHS of a substitution?
4.7. How do I represent control-codes or non-printable characters?
4.8. How do I read environment variables with sed?

 4.8.1. - on Unix platforms
 4.8.2. - on MS-DOS or 4DOS platforms

4.9. How do I export or pass variables back into the environment?

 4.9.1. - on Unix platforms
 4.9.2. - on MS-DOS or 4DOS platforms

4.10. How do I handle shell quoting in sed?
4.11. How do I delete a block of text if the block contains a certain
      regular expression?
4.12. How do I locate/print a paragraph of text if the paragraph
      contains a certain regular expression?
4.13. How do I delete a block of _specific_ consecutive lines?
4.14. How do I read (insert/add) a file at the top of a textfile?
4.15. How do I address all the lines between RE1 and RE2, excluding
      the lines themselves?
4.16. How do I replace "/some/UNIX/path" in a substitution?
4.17. How do I replace "C:\SOME\DOS\PATH" in a substitution?
4.18. How do I convert files with toggle characters, like +this+, to
      look like [i]this[/i]?
4.19. How do I delete only the first occurrence of a pattern?
4.20. How do I commify a string of numbers?

5. WHY ISN'T THIS WORKING?
5.1. Why don't my variables like $var get expanded in my sed script?
5.2. I'm using 'p' to print, but I have duplicate lines sometimes.
5.3. Why does my DOS version of sed process a file part-way through
     and then quit?
5.4. My RE isn't matching/deleting what I want it to. (Or, "Greedy vs.
     stingy pattern matching")
5.5. What is CSDPMI*B.ZIP and why do I need it?
5.6. Where are the man pages for GNU sed?
5.7. How do I tell what version of sed I am using?
5.8. Does sed issue an exit code?
5.9. The 'r' command isn't inserting the file into the text.
5.10. Why can't I match or delete a newline using the \n escape               |
      sequence? Why can't I match 2 or more lines using \n?                   |
5.11. My script aborts with an error message, "event not found".              |

6. OTHER ISSUES
6.1. I have a problem that stumps me. Where can I get help?
6.2. How does sed compare with awk, perl, and other utilities?
6.3. When should I use sed?
6.4. When should I NOT use sed?
6.5. When should I ignore sed and use Awk or Perl instead?
6.6. Known limitations among sed versions
6.7. Known bugs among sed versions
6.8. Known incompatibilities between sed versions

 6.8.1. Issuing commands from the command line
 6.8.2. Using comments (prefixed by the '#' sign)
 6.8.3. Special syntax in REs
 6.8.4. Word boundaries
 6.8.5. Range addressing with GNU sed and HHsed
 6.8.6. Commands which operate differently                                    |

------------------------------

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, write us and we'll try to clarify it for the
   next version of the FAQ.

1.2. Latest version of the sed FAQ

   The newest version of the sed FAQ is usually here:

      http://www.cornerstonemag.com/sed/sedfaq.html
      http://www.cornerstonemag.com/sed/sedfaq.txt
      http://www.dbnet.ece.ntua.gr/~george/sed/sedfaq.html
      http://www.dbnet.ece.ntua.gr/~george/sed/sedfaq.txt
      http://www.ptug.org/sed/sedfaq.html
      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:

      http://www.dreamwvr.com/sed-info/sed-faq.html

1.3. FAQ revision information

   Changes to this FAQ since the last version are indicated 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 succinctly and clearly, and e-mail it Eric
   Pement , indicating your proposed addition to
   the FAQ. We'll post it on the sed-users mailing list (see section
   2.3.2, below) and discuss it there. If some agreement, your
   contribution will be included in the next edition of the FAQ.

1.5. FAQ abbreviations:

   files = one or more filenames, separated by whitespace
   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.

   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 the syntax of Basic Regular Expressions (BREs), type "man
   ed" and read the documentation for regular expressions. A technical
   description of BREs from the Single UNIX Specification, Version 2,
   by The Open Group (joint committee on Unix) is available online at
   .     |
   Sed normally supports BREs plus '\n' to match a newline in the
   pattern space and '\xREx' as equivalent to '/RE/', where 'x' is any
   character other than another backslash.

   Some versions of sed support supersets of BREs, or "extended
   regular expressions", which offer additional metacharacters for
   increased flexibility. For additional information on extended REs
   in GNU sed, see sections 3.7 ("GNU/POSIX extensions to regular
   expressions") and 6.8.3 ("Special syntax in REs"), below.

   LHS: In sed, the LHS may be a string literal (e.g., "foo") or any
   valid regular expression supported by your version of sed. Some
   versions of sed support things like \t for TAB, \r for carriage
   return, \xNN for direct entry of hex codes, etc. Other versions of
   sed do not support this syntax.

   RHS: The right-hand side (the replacement part in s/find/replace/)
   is almost always a string literal, with no interpolation of the
   metacharacters (.), (^), ($), ([), or \(...\) -- with the following
   exceptions:  \1 through \9 are replaced by the corresponding group,
   if grouping \(...\) was used in the LHS.  If no grouping was used
   in the LHS, then \1 through \9 are replaced by literal digits. '&'
   is replaced by the entire expression matched on the LHS. To enter a
   literal ampersand or backslash in the RHS, type '\&' or '\\'.

1.6. Credits and acknowledgements

   My time spent messing with sed, composing this FAQ, and generally
   doing text manipulation which is unrelated to my job description is
   due to the kind tolerance of the Christian magazine I work for,
   Cornerstone. So, let me say thanks to the mag staff for indulging
   this somewhat unusual "ministry." Please visit this site:

      http://www.cornerstonemag.com

   Many of the ideas for this FAQ were taken from the Awk FAQ
      http://www.faqs.org/faqs/computer-lang/awk/faq/
      ftp://rtfm.mit.edu/pub/usenet/comp.lang.awk/faq

   and from the Perl FAQ
      http://www.perl.com/perl/FAQ
      http://www.perl.com/CPAN/doc/FAQs/FAQ/html/index.html
      ftp://ftp.cdrom.com/pub/perl/CPAN/doc/FAQs/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 
      Walter Briscoe 
      Jim Dennis 
      Carlos Duarte 
      Otavio Exel 
      Mark Katz 
      Eric Pement                                          |
      Greg Pfeiffer 
      Ken Pizzini 
      Niall Smart 
      Simon Taylor 
      Greg Ubben 

   Note: Periods (.) are replaced with asterisks (*) to foil e-mail
   harvesting and spam-bots.

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 errors or
   ambiguous wording, please notify the FAQ maintainer so it can be
   fixed for the next edition.

------------------------------

2. BASIC SED

2.1. What is sed?

   "sed" stands for Stream EDitor. Sed is a non-interactive editor,
   written by the late Lee E. McMahon in 1973 or 1974. A brief history
   of sed's origins may be found in an early history of the Unix
   tools, at .

   Instead of the user altering a file interactively by moving the
   cursor on the screen (like with Word Perfect), the user sends a
   script of editing instructions to sed, plus the name of the file to
   edit (or the text to be edited may come as output from a pipe). In
   this sense, sed works like a filter -- deleting, inserting and
   changing characters, words, and lines of text. Its range of
   activity goes from small, simple changes to very complex ones.

   Sed reads its input from stdin (Unix shorthand for "standard
   input," i.e., the console) or from files (or both), and sends the
   results to stdout ("standard output," normally the console or
   screen). Most people use sed first for its substitution features.
   Sed is often used as a find-and-replace tool.

      sed 's/Glenn/Harold/g' oldfile >newfile

   will replace every occurrence of "Glenn" with the word "Harold",
   wherever it occurs in the file. The "find" portion is a regular
   expression ("RE"), which can be a simple word or may contain
   special characters to allow greater flexibility (for example, to
   prevent "Glenn" from also matching "Glennon").

   My very first use of sed was to add 8 spaces to the left side of a
   file, so when I printed it, the printing wouldn't begin at the
   absolute left edge of a piece of paper.

      sed 's/^/        /' myfile >newfile   # my first sed script
      sed 's/^/        /' myfile | lp       # my next sed script

   Then I learned that sed could display only one paragraph of a file,
   beginning at the phrase "and where it came" and ending at the
   phrase "for all people". My script looked like this:

      sed -n '/and where it came/,/for all people/p' myfile

   Sed's normal behavior is to print (i.e., display or show on screen)
   the entire file, including the parts that haven't been altered,
   unless you use the -n switch. The "-n" stands for "no output". This
   switch is almost always used in conjunction with a 'p' command
   somewhere, which says to print only the sections of the file that
   have been specified. The -n switch with the 'p' command allow for
   parts of a file to be printed (i.e., sent to the console).

   Next, I found that sed could show me only (say) lines 12-18 of a
   file and not show me the rest. This was very handy when I needed to
   review only part of a long file and I didn't want to alter it.

      sed -n 12,18p myfile   # the 'p' stands for print

   Likewise, sed could show me everything else BUT those particular
   lines, without physically changing the file on the disk:

      sed 12,18d myfile      # the 'd' stands for delete

   Sed could also double-space my single-spaced file when it came time
   to print it:

      sed G myfile >newfile

   If you have many editing commands (for deleting, adding,
   substituting, etc.) which might take up several lines, those
   commands can be put into a separate file and all of the commands in
   the file applied to file being edited:

      sed -f script.sed myfile  # 'script.sed' is the file of commands
                                # 'myfile' is the file being changed

   It is not our intention to convert this FAQ file into a full-blown
   sed tutorial (for good tutorials, see section 2.3). Rather, we hope
   this gives the complete novice a few ideas of how sed can be used.

2.2. What versions of sed are there, and where can I get them?

2.2.1. Free versions

   Note: "Free" does not mean "public domain" nor does it necessarily
   mean you will never be charged for it. All versions of sed in this
   section except the CP/M versions are based on the GNU general
   public license and are "free software" by that standard (for
   details, see http://www.gnu.org/philosophy/free-sw.html). This
   means you can get the source code and develop it further.

   At the URLs listed in this category, sed binaries or source code
   can be downloaded and used without fees or license payments.

2.2.1.1. Unix platforms

   GNU sed v3.02.80
   Now a,i,c commands can accept a string after them. Range syntax now
   supports "/RE/,+n" (next n lines) or "/RE/,~n" (till the next line
   which is a multiple of n). NULs permitted in regexes; \n, \t, \a,
   \f, \xHH hex codes supported on LHS and RHS; more changes. An alpha
   test release which (if found bug-free) will become GNU sed version
   3.03. Supersedes GNU sed-3.02a.
      ftp://alpha.gnu.org/pub/gnu/sed/sed-3.02.80.tar.gz

   GNU sed v3.02a
   Interim version with most of what is now gsed-3.02.80 (above),
   which supersedes it.

   GNU sed v3.02
   This is the latest official version of GNU sed
      ftp://ftp.gnu.org/pub/gnu/sed/sed-3.02.tar.gz

   GNU sed v2.05
   This version is superseded by v3.02 and v3.02.80, above.

   GNU mirror sites. A list of mirror sites is at:
      http://www.ensta.fr/internet/unix/GNU-archives.html

   Precompiled versions:

   GNU sed v3.02-4
   source code and binaries for Debian GNU/Linux
      http://www.debian.org/Packages/unstable/base/sed.html

   GNU sed v3.02-1
   source code and binaries for Debian GNU/Linux
      http://www.debian.org/Packages/stable/base/sed.html

   The 4.4BSD version of sed is available from any 4.4BSD-Lite2 mirror
   site:
      ftp://ftp.ntua.gr/pub/bsd/4.4BSD/usr/src/usr.bin/sed/

   For some time, the GNU project  used Eric S.
   Raymond's version of sed (ESR sed v1.1), but eventually dropped it
   because it had too many built-in limits. In 1991 Howard Helman
   modified the GNU/ESR sed and produced a flexible version of sed
   v1.5 available at several sites (Helman's version permitted things
   like \<...\> to delimit word boundaries, \xHH to enter hex code and
   \n to indicate newlines in the replace string). This version did
   not catch on with the GNU project and their version of sed has
   moved in a similar but different direction.

   sed v1.3, by Eric Steven Raymond (released 4 June 1998)
      http://earthspace.net/~esr/sed-1.3.tar.gz

   Eric Raymond  wrote one of the earliest
   versions of sed. On his website  which
   also distributes many freeware utilities he has written or worked
   on, he describes sed v1.1 this way:

   "This is the fast, small sed originally distributed in the GNU
   toolkit and still distributed with Minix. The GNU people ditched it
   when they built their own sed around an enhanced regex package --
   but it's still better for some uses (in particular, faster and less
   memory-intensive)." (Version 1.3 fixes an unidentified bug and adds
   the L command to hexdump the current pattern space.)

2.2.1.2. OS/2

   GNU sed v3.02.80                                                           |
      http://www2s.biglobe.ne.jp/~vtgf3mpr/gnu/sed.htm                        |

   GNU sed v2.05 (requires 'emxrt.zip', below)
      http://oak.oakland.edu/pub/os2/editors/gnused.zip
      http://oak.oakland.edu/pub/os2/emx09c/emxrt.zip

   GNU sed v1.06
      http://oak.oakland.edu/pub/os2/editors/sed106.zip

2.2.1.3. Microsoft Windows (Win3x, Win9x, WinNT, Win2K)

   GNU sed v3.02.80
   32-bit binaries and docs, using DJGPP compiler. For details on new
   features, see Unix section, above.
      http://www.cornerstonemag.com/sed/sed3028a.zip     # DOS binaries
      ftp://alpha.gnu.org/pub/gnu/sed/sed-3.02.80.tar.gz # source

   GNU sed v3.02
   32-bit binaries and source, using DJGPP compiler. Requires 80386 SX
   or better. Also requires 3 CWS*.EXE extenders if run under MS-DOS.
   See section 5.5 ("What is CSDPMI*B.ZIP and why do I need it?"),
   below. This version will run under Windows or under MS-DOS.

   The binary archive (sed302b.zip) contains 2 executables, sed.exe
   and gsed.exe.  sed.exe was compiled with the DJGPP regex library,
   which is POSIX.2-compliant and usually runs faster; gsed.exe was
   compiled with the GNU regex library, which though it runs slower
   and is almost POSIX.2-compliant, it has a richer set of regexs and
   will run faster on certain complex regexs which cause the DJGPP
   sed.exe to run extremely slowly.
      ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed302b.zip
      ftp://ftp.cdrom.com/.27/simtelnet/gnu/djgpp/v2gnu/sed302b.zip
      ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed302s.zip
      ftp://ftp.cdrom.com/.27/simtelnet/gnu/djgpp/v2gnu/sed302s.zip

   GNU sed v2.05
   32-bit binaries, no docs. Requires 80386 DX (SX will not run) and
   must be run in a DOS window or in a full screen DOS session under
   Microsoft Windows. Will not run in MS-DOS mode (outside Win/Win95).
   We recommend using GNU sed v3.02 (above) instead.
      http://www.simtel.net/pub/simtelnet/win95/prog/gsed205b.zip
      ftp://ftp.cdrom.com/.27/simtelnet/win95/prog/gsed205b.zip

   GNU sed v1.03
   modified by Frank Whaley.
      ftp://ftp.itribe.net/pub/virtunix/gnused.zip

   Again, we recommend avoiding versions of GNU sed other than version
   3.02 or 3.02.80. However, this version appears to be built on gsed
   v1.03 beta as a base and then augmented farther. The authors did
   not give this sed its own version number or name. Gsed v1.03 is
   offered in the "Virtually UN*X" set of Win32 utilities at
   . It supports Win 95/98/NT long
   filenames, and runs in a DOS session or DOS window under Microsoft
   Windows, but does not run in DOS mode. This version of sed supports
   hex, decimal, binary, and octal representation in expressions.

   The Cygwin toolkit:
      http://sourceware.cygnus.com/cygwin/

   Formerly know as "GNU-Win32 tools." According to their home page,
   "The Cygwin tools are Win32 ports of the popular GNU development
   tools for Windows NT, 95 and 98. They function through the use of
   the Cygwin library which provides a UNIX-like API on top of the
   Win32 API." The version of sed used is GNU sed v3.02.

   Minimalist GNU-Win32 (Mingw32):
      ftp://agnes.dida.physik.uni-essen.de/home/janjaap/mingw32/binaries/sed-2.05.zip
      http://agnes.dida.physik.uni-essen.de/~janjaap/mingw32/download.html

   According to their home page, "The Minimalist GNU-Win32 Package (or
   Mingw32) is simply a set of header files and initialization code
   which allows a GNU compiler to link programs with one of the C
   run-time libraries provided by Microsoft. By default it uses
   CRTDLL, which is built into all Win32 operating systems." The
   download page says Mingw32 programs "behave like you would expect
   from a Windows application. They support drive letters, for
   example. A side effect of using CRTDLL is that Mingw32 is
   thread-safe, while Cygwin32 is not." The version of sed used is GNU
   sed v2.05.

   sed v1.5 (a/k/a HHsed), by Howard Helman
   Compiled with Mingw32 for 32-bit environments described above. This
   version should support Win95 long filenames.
      http://www.dbnet.ece.ntua.gr/~george/sed/sed15.exe
      http://www.cornerstonemag.com/sed/sed15exe.zip

2.2.1.4. MS-DOS

   sed v1.5 (a/k/a HHsed), by Howard Helman
   uncompiled source code (Turbo C)
      ftp://ftp.simtel.net/pub/simtelnet/msdos/txtutl/sed15.zip
      ftp://ftp.cdrom.com/pub/simtelnet/msdos/txtutl/sed15.zip
      ftp://oak.oakland.edu/pub/simtelnet/msdos/txtutl/sed15.zip
      ftp://uiarchive.uiuc.edu/pub/systems/pc/simtelnet/msdos/txtutl/sed15.zip

   DOS executable and documentation
      ftp://ftp.simtel.net/pub/simtelnet/msdos/txtutl/sed15x.zip
      ftp://ftp.cdrom.com/pub/simtelnet/msdos/txtutl/sed15x.zip
      ftp://oak.oakland.edu/pub/simtelnet/msdos/txtutl/sed15x.zip
      ftp://uiarchive.uiuc.edu/pub/systems/pc/simtelnet/msdos/txtutl/sed15x.zip

   sedmod v1.0, by Hern Chen
      http://www.ptug.org/sed/SEDMOD10.ZIP
      http://www.cornerstonemag.com/sed/sedmod10.zip
      ftp://garbo.uwasa.fi/pc/unix/sedmod10.zip
      CompuServe DTPFORUM, "PC DTP Tools" library, file SEDMOD.ZIP

   GNU sed v3.02.80
   See section 2.2.1.3 ("Microsoft Windows"), above.

   GNU sed v3.02
   See section 2.2.1.3 ("Microsoft Windows"), above.

   GNU sed v2.05
   Does not run under MS-DOS.

   GNU sed v1.18
   32-bit binaries and source, using DJGPP compiler. Requires 80386 SX
   or better. Also requires 3 CWS*.EXE extenders on the path. See
   section 5.5 ("What is CSDPMI*B.ZIP and why do I need it?"), below.
   We recommend using GNU sed v3.02 (above) instead.
      http://www.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed118b.zip
      ftp://ftp.cdrom.com/pub/simtelnet/gnu/djgpp/v2gnu/sed118b.zip
      http://www.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/sed118s.zip
      ftp://ftp.cdrom.com/pub/simtelnet/gnu/djgpp/v2gnu/sed118s.zip

   GNU sed v1.06
   16-bit binaries and source. Should run under any MS-DOS system.
      http://www.simtel.net/pub/simtelnet/gnu/gnuish/sed106.zip
      ftp://ftp.cdrom.com/pub/simtelnet/gnu/gnuish/sed106.zip

2.2.1.5. CP/M

   ssed v2.2, by Chuck A. Forsberg
      http://oak.oakland.edu/pub/cpm/txtutl/ssed22.lbr

   Written for CP/M, ssed (for "small/stupid stream editor) supports
   only the a(ppend), c(hange), d(elete) and i(nsert) options, and
   apparently doesn't support regular expressions. It does have a -u
   option to "unsqueeze" compressed files and was used mainly in
   conjunction with dif.com for source code maintenance.

   change, by Michael M. Rubenstein
      http://oak.oakland.edu/pub/cpm/txtutl/ttools.lbr

   Rubenstein probably felt that "sed" was an obscure name, so he
   renamed it CHANGE.COM (the TTOOLS.LBR archive member CHANGE.CZM is
   a "crunched" file). Unlike ssed, change supports full RE's except
   for grouping and backreferences, and its only function is for
   global substitution.

2.2.2. Shareware and Commercial versions

2.2.2.1. Unix platforms

      ** Information needed **

2.2.2.2. OS/2

   Hamilton Labs:
      http://www.hamiltonlabs.com/cshell.htm

   A sizable set of Unix/C shell utilities designed for OS/2. Price is
   $350 in the US, $395 elsewhere, with FedEx shipping, unconditional
   guarantee, unlimited support and free updates. A demo version of
   the suite can be downloaded from this site, but a stand-alone copy
   of sed is not available.

2.2.2.3. Windows 95/98, Windows NT, Windows 2000

   Hamilton Labs:
      http://www.hamiltonlabs.com/cshell.htm

   A sizable set of Unix/C shell utilities designed for Win9x, WinNT,
   and Win2K. Price is $350 in the US, $395 elsewhere, with FedEx
   shipping, unconditional guarantee, unlimited support and free
   updates. A demo version of the suite can be downloaded from this
   site, but a stand-alone copy of sed is not available.

   Interix:
      http://www.interix.com

   Interix (formerly known as OpenNT) is advertised as "a complete
   UNIX system environment running natively on Microsoft Windows NT",
   and is licensed and supported by Softway Systems. It offers over
   200 Unix utilities, and supports Unix shells, sockets, networking,
   and more. A single-user edition runs about $200. A free demo or
   evaluation copy will run for 31 days and then quit; to continue
   using it, you must purchase the commercial version.

   MKS NuTCRACKER Professional
      http://www.datafocus.com/products/nutc/

   A different, yet related product line offered by MKS (Mortice Kern
   Systems, below); the awkward spelling "NuTCRACKER" is intentional.
   Various packages offer hundreds of Unix utilities for Win32
   environments. Sed is not available as a separate product.

   UnixDos:
      http://www.unixdos.com

   UnixDos is a suite of 82 Unix utilities ported over to the Windows
   environments. There are 16-bit versions for Win 3.1 and 32-bit
   versions for WinNT/Win95. It is distributed as uncrippled shareware
   for the first 30 days. After the test period, the utilities will
   not run and you must pay the registration fee of $50.

   Their version of sed supports "\n" in the RHS of expressions, and
   increases the length of input lines to 10,000 characters. By
   special arrangement with the owners, persons who want a licensed
   version of sed *only* (without the other utilities) may pay a
   license fee of $10.

   U/WIN:
      http://www.research.att.com/sw/tools/uwin/

   U/WIN is a suite of Unix utilities created for WinNT and Win95
   systems. It is owned by AT&T, created by David Korn (author of the
   Unix korn shell), and is freely distributed only to educational
   institutions, AT&T employees, or certain researchers; all others
   must pay a fee after a 90-day evaluation period expires. U/WIN
   operates best with the NTFS (WinNT file system) but will run in
   degraded mode with the FAT file system and in further degraded mode
   under Win95. A minimal installation takes about 25 to 30 megs of
   disk space. Sed is not available as a separate file for download,
   but comes with the suite.

2.2.2.4. MS-DOS

   Mix C/Utilities Toolchest                                                  |
      http://www.mixsoftware.com/product/utility.htm                          |

   According to their web page, "The C/Utilities Toolchest adds over          |
   40 powerful UNIX utilities to your MS-DOS operating system. The            |
   result is an environment very similar to UNIX operating systems,           |
   yet 100% compatible with MS-DOS programs and commands." The                |
   toolchest costs $19.95, with source code available for an                  |
   additional fee. Mix C's version of sed is not available separately.        |

   MKS (Mortice Kern Systems) Toolkit
      http://www.mks.com

   Sed comes bundled with the MKS Toolkit, which is distributed only
   as commercial software; it is not available separately.

   Thompson Automation Software
      http://www.teleport.com/~thompson/

   The Thompson Toolkit contains over 100 familiar Unix utilities,
   including a version of the Unix Korn shell. It runs under MS-DOS,
   OS/2, Win 3.0/3.1, Win95, and WinNT. Sed is one of the utilities,
   though Thompson is better known for its version of awk for DOS,
   TAWK. The toolkit runs about $150; sed is not available separately.

2.3. Where can I learn to use sed?

2.3.1. Books

   _Sed & Awk, 2d edition_, by Dale Dougherty & Arnold Robbins
   (Sebastopol, Calif: O'Reilly and Associates, 1997)
   ISBN 1-56592-225-5
      http://www.oreilly.com/catalog/sed2/noframes.html

   About 40 percent of this book is devoted to sed, and maybe 50
   percent is devoted to awk. The other 10 percent is given to regular
   expressions and concepts which are common to both tools. If you
   prefer hard copy, this is definitely the best single place to learn
   to use sed, including its advanced features.

   The first edition is also very useful. Several typos crept into the
   first printing of the first edition (though if you follow the
   tutorials closely, you'll recognize them right away). A list of
   errors from the first printing of _sed & awk_ is available at
   , and errors in
   the 2nd are at ,
   though most of these were corrected in later printings. The second
   edition tells how POSIX standards have affected these tools and
   covers the popular GNU versions of sed and awk. Price is about (US)
   $30.00

   -----

   _Mastering Regular Expressions_, by Jeffrey E. F. Friedl
   (Sebastopol, Calif: O'Reilly and Associates, 1997)
   ISBN 1-56592-257-3
      http://www.oreilly.com/catalog/regex/
      http://enterprise.ic.gc.ca/~jfriedl/regex/index.html

   Knowing how to use "regular expressions" is essential to effective

Section 1 of 5 - Prev - Next
All sections - 1 - 2 - 3 - 4 - 5

Back to category editor-faq - Use Smart Search
Home - Smart Search - About the project - Feedback

© allanswers.org | Terms of use

LiveInternet