Re: Simplest sed

Date: Wed Nov 22 2000 - 03:25:01 CET


On 2000-11-21 said:

 mu>How do I make sed replace one
 mu>thing by another (surely, that's what you use sed for?)? For
 mu>example, how do I replace all occurences of #include <old.h> by
 mu>#include <new.h> in a c-program?

 sed -e 's/old\.h/new\.h/g' old.c > new.c

 should do it. But I've been wrong before...

 Note: The backslash is used to quote the period as it has a
 special meaning for sed (and in all regular expressions).

 A look at:

 could give you some more pointers.

 And do take a look at regular expressions. It's well worth the
 trouble. They are used extensively everywhere in the *nix
 world. sed, grep, perl etc etc.


A mathematician is a machine for converting coffee into theorems.

Net-Tamer V 1.10.1 - Registered

To unsubscribe, e-mail:
For additional commands, e-mail:

This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:16 CET