-1

My file has 2 times stamps in every line. I would like to delete the +0800 in every line using sed. I have tried the following command labelled "command used"

Example input    
2020-11-17 08:50:42.614276+0800 2020-11-17 08:50:42.000000+0800

Command used
sed -E 's/\+\d{4}//g'

Actual Output (same as input)
2020-11-17 08:50:42.614276+0800 2020-11-17 08:50:42.000000+0800

Expected Output
2020-11-17 08:50:42.614276 2020-11-17 08:50:42.000000
KOOTS HOOTS
  • 63
  • 2
  • 10

1 Answers1

0

Use

sed -E 's/\+[0-9]{4}//g'

or

sed -E 's/\+[[:digit:]]{4}//g'

instead, as sed does not recognize \d.

Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134