For example with n being 3, p1ath/p2ath/p3ath would become p1a/p2a/p3?
I don't understand how to:
- Truncate a capture group (
\1,\2, etc..) using sed. - How to make the capture groups 'dynamic' rather being a set static number of capture groups?
So far I have 's/\(.*\)\//\1\//g'