Issue
In Linux I can run the command:
sed -r 's/^(.{2})0(.*)$/\1\2/' filename
However when running in UNIX I cant do -r
so I tried:
sed 's/^(.{2})0(.*)$/\1\2/' filename
I get the following error:
sed: command garbled: s/^(.{2})0(.*)$/\1\2/
I feel like there is an easy fix but I cant figure it out.
Solution
The following is working for me:
sed 's/^\(.\{2\}\)0\(.*\)$/\1\2/'
You need to escape (){}
Edit: This will also solve your problem and is shorter. There is no need to continue searching to the end of the line.
sed 's/^\(.\{2\}\)0/\1/'
Answered By - Tom Answer Checked By - Mary Flores (WPSolving Volunteer)