procmail
[Top] [All Lists]

sed substitute (was: hex value in condition)

1997-08-10 10:25:00
On Sun, 10 Aug 1997, Mitsuru Furukawa wrote:

era eriksson <era(_at_)iki(_dot_)fi> wrote:

era> On Sun, 10 Aug 1997 07:38:23 +0900,
era> Mitsuru Furukawa <furu(_at_)009(_dot_)com> wrote:
era>  > BTW, could you teach me what this sed script is supposed to do?
era>  > | sed -e 's+^- -+-+' \
era>  > I browsed sed man page but could not find any clue.
era> 
era> It will translate "- -" at beginning of line to "-". 

So, + in sed corresponds to / in perl???

It (and almost any other character) can do so in some
sed commands. (Actually, can't characters other than '/' be
used as delimiters in perl as well?) In any case, see the
following paragragh in man sed:

[2addr]s/regular expression/replacement/flags

Substitute the replacement string for the first instance of the
regular expression in the pattern space.  Any character other
than backslash or newline can be used instead of a slash to de-
limit the RE and the replacement...

Isn't + used for r+ expression which matches to r once or more?

As sed uses Basic Regular Expressions, the '+' has to be
backslashed in order to acquire metacharacter status -
i.e.- 'r\+'.
 

Jim Irwin <jirwin(_at_)mail(_dot_)netshop(_dot_)net>
running (..um..walking) Linux 2.0.30

<Prev in Thread] Current Thread [Next in Thread>