4 ms·
Doesn't appear anyone has tried addressing before replacement - ie the simplest sed work-a-like - if you don't mind the leading ### is just: sed -n '/^### /p
by e12e 6y ago
Doesn't appear anyone has tried addressing before replacement - ie the simplest sed work-a-like - if you don't mind the leading ### is just:
sed -n '/^### /p'
I believe? (equivalent to grep).
Then eg:
sed -nr '/^### /s/^.{4}(.*)/\1/p'
(or without the redundant addressing, just:)
sed -nr 's/^### (.*)/\1/p'
- bewuethr 6y agoYou can simplify sed -nr 's/^.{4}(.*)/\1/' to sed -nr 's/^.{4}// And if you use a pattern for the address, you can repeat it in the substitution by using an empty pattern, so sed -nr '/^### /s/^.{4}(.*)/\1/p' is the same as sed -nr '/^### /s/^.{4}//p' is the same as sed -nr '/^### /s///p' at which point I prefer just the substitution: sed -nr 's/^### //p'