3 ms·
The sed extraction example is more complicated than it needs to be: echo "sample with /path/" | sed -E 's|.*(/.*/)|\1|g' The search/replace separator does
by karmakaze 1y ago
The sed extraction example is more complicated than it needs to be:
echo "sample with /path/" | sed -E 's|.*(/.*/)|\1|g'
The search/replace separator doesn't have to be '/'.
I can't see myself using this for a performance bump given that I already know vi, thus sed expressions.
- sudahtigabulan 1y agoThe newline replacement stopped me in my tracks: sed ':a;N;$!ba;s/\n/,/g' Nobody does that with sed, when there are way simpler alternatives, like paste and tr.