bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SED


From: Stepan Kasal
Subject: Re: SED
Date: Thu, 12 Sep 2002 14:53:43 +0200
User-agent: Mutt/1.2.5.1i

Hello,
        Gopikrishna Kannan reported a bug regarding the program:
> $ cat cmdfile
> s/.*PrintArgs.*$/#ifdef DEBUG \\n  & \\n  #endif \\n /g

This is not a bug, you've misunderstood the documentation.

The manual speaks about "\<newline>" and means the byte '\\'
followed mmediately by the byte '\n'.  IOW, backslash at the end
of a line.

So your sed program should look like this:
s/.*PrintArgs.*$/#ifdef DEBUG\
&\
#endif/

In this concrete stituation, the sed program

/PrintArgs/{
i\
#ifdef DEBUG
a\
#endif
}

may be more appropriate.  (Or you could use another tool, eg. awk.)

HTH,
        Stepan Kasal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]