MattUK
August 31st, 2008, 08:06 PM
Hi all,
I am trying to remove dates, in the format "(YYYY)" in a string, the only examples i've been able to find are replacing words, not patterns - I can get it to work with [0-9] but not anything else, e.g. \d{4} so I figure i'm doing something seriously wrong here.
This is what I am trying, which isn't doing anything:
input_string="Blarp (2008) XYZ"
result=$(echo $input_string | sed -e 's/\(\d{4}\)/*/g')
echo $result
Any help greatly appreciated, I've been pulling my hair out for 2 hours already on this one problem!
I am trying to remove dates, in the format "(YYYY)" in a string, the only examples i've been able to find are replacing words, not patterns - I can get it to work with [0-9] but not anything else, e.g. \d{4} so I figure i'm doing something seriously wrong here.
This is what I am trying, which isn't doing anything:
input_string="Blarp (2008) XYZ"
result=$(echo $input_string | sed -e 's/\(\d{4}\)/*/g')
echo $result
Any help greatly appreciated, I've been pulling my hair out for 2 hours already on this one problem!