First, using the -r option to SED, tells it to use Extended Regex (ERE) not Regex (RE). Using the
+ modifier as part of an ERE does not require that you escape it.
Code:
sed -r 's/H[0-9]+J[0-9]+ ?//g' # or if you must use POSIX char sets
sed -r 's/H[[:digit:]]+J[[:digit:]]+[[:space:]]?//g
Using the
+ modifier as you did will try to match one or more whitespaces at the end of the line. Since there is no whitespace at the end of the line, it will always fails. Use the
? modifier to match zero or more spaces, which will find a match even at the end of the line.
Hope this helps.