Re: Simplest sed

From: Michele Andreoli (m.andreoli@tin.it)
Date: Wed Nov 22 2000 - 08:25:27 CET


On Tue, Nov 21, 2000 at 11:00:26PM +0100, Mark Roberts nicely wrote:
> Hi all,
>
> I have a blind eyed question: while I have plenty of experience with awk,
> I have never ever used sed. How do I make sed replace one thing by
> another (surely, that's what you use sed for?)? For example, how do I
> replace all occurences of #include <old.h> by #include <new.h> in a
> c-program?
>
> Thanks. There's always a first time. Mine is today.
>

sed is a stream editor. Try that:

        cat source.c | sed "s/<old\.h>/<new\.h>/g"

Michele

-- 
In summing up, I wish I had some kind of affirmative message to leave
you with, I don't. Would you take two negative messages? - Woody Allen
---------------------------------------------------------------------
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