Zee
Zee

Reputation: 1420

Sed Invalid range end error with captured group

I am trying to run the following bash program with sed and I am seeing an sed: -e expression #1, char 44: Invalid range end . I tried adding the -r option but still seeing the error.

#!/bin/bash


TEST="--extra-vars user=jsmith a=abcd --test"

echo $TEST | sed -re "s/(--extra-vars )([a-zA-z0-9\=\s]*)\b/\1\2/g"

Upvotes: 0

Views: 696

Answers (1)

Aaron
Aaron

Reputation: 24812

You're getting an Invalid range end error because you've wrote A-z inside your character class, which is a negative range (z < A).

Upvotes: 4

Related Questions