Q:

Using sed to find and replace a range of numbers

first poster here.
Trying to use sed to find and replace a word. Code is as follows:
configFile=ConnectionConfig.xml
sed 's/30??\" authentication=\"someuniqueauthkey/'$1'\" authentication=\"someuniqueauthkey/' $configFile

And I'd run the file like this:
./choosePort.sh 3001

When I run this code, there are no errors given like bad regex format, it just doesn't replace anything and the contents of tempXml.xml are just the contents of ConnectionConfig, unchanged.
What I'd like to be able to do is recognise any number 3000 - 3099 in the 30?? part of the expression, which I thought was what the '?' did.
The input line I'm trying to change is:
<host id="0" address="someip" port="3001" authentication="someauthkey"

Thanks in advance.
(Ip and authkeys in file blanked out for security reasons).

A:

Use [0-9] instead of ? to match a single digit.
sed 's/30[0-9][0-9]\" authentication=\"someuniqueauthkey/'$1'\" authentication=\"someuniqueauthkey/' $configFile

