I'm trying to delete a character that is at the start of the line of multiple string, but, also have another pattern just before the start of the line, which i don't want to delete:
1:string:test... 2:string test 3:etc...
1 string:test... 2 string test 3 etc...
Some string can also contain the character
: which make things interesting. So far i tried:
echo "1:test:" | grep -Pv '(?<=\d):'
which does match the
: character (at least it highlight it, so I'm guessing it's matched) but it doesn't get omitted when using the
-v flag, maybe because it's on the same line as the match? (Here i only did experiment on how to match it and remove it instead of replacing it with a space, as the aforementioned example showed)
echo "1:test:" | sed 's/^.:./ /g'
This seems to be the closest i got, but it cut off the rest of the start beside the
: character, which give: