3 ms·
I just added a sed version as well. I'll have to click through and see how closely it resembles what's in the gist. bash is actually pretty powerful if you don
by js2 4y ago
I just added a sed version as well. I'll have to click through and see how closely it resembles what's in the gist.
bash is actually pretty powerful if you don't mind its baroque syntax. Writing it in POSIX would be a bit more challenging. You could use a case statement for the pattern matching, but I'm not sure about the substitution.