From: Lars.Nordstrom@abc.se
Date: Wed Nov 22 2000 - 03:25:01 CET
Hello.
On 2000-11-21 mulinux@sunsite.auc.dk 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:
http://www.cornerstonemag.com/sed/sedfaq.html
http://www.cornerstonemag.com/sed/sedfaq.txt
http://www.cornerstonemag.com/sed/sed1line.txt
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.
Regards,
Lars
A mathematician is a machine for converting coffee into theorems.
Net-Tamer V 1.10.1 - Registered
---------------------------------------------------------------------
To unsubscribe, e-mail: mulinux-unsubscribe@sunsite.auc.dk
For additional commands, e-mail: mulinux-help@sunsite.auc.dk
This archive was generated by hypermail 2.1.6 : Sat Feb 08 2003 - 15:27:16 CET