[Top][All Lists]

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

sed bug with options -ir

From: David Watzke
Subject: sed bug with options -ir
Date: Tue, 30 Aug 2011 21:33:34 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

Hi there,

I've encountered a strange bug in sed (or maybe it's not a bug and I'm missing something here):

this command works fine and adds dashes between numbers:
sed -i -r "s/([0-9]+) ([0-9]+) ([0-9]+)$/\1-\2-\3/" mobily.txt

the file mobily.txt contains something like this (it's not important):
name surname 000 111 222

but the same command with -i and -r written in a short form like this doesn't work:
sed -ir "s/([0-9]+) ([0-9]+) ([0-9]+)$/\1-\2-\3/" mobily.txt
sed: -e expression #1, char 39: invalid reference \3 on `s' command's RHS

Why is that?

David Watzke

reply via email to

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