Artificial intelligent assistant

awk or sed to Parse Elements from Directory Path Say I have several directories of varying length in the form /tmp/(1) I. First Majuscule Roman Numeral/01. First Arabic Numeral/a. First Grapheme /tmp/(2) II. Second Majuscule/03. Third Arabic/d. Fourth that I want to parse so the output is I.01.a. II.03.d. What's the awk and/or sed solution?

Assuming those are tho _only_ directories beneath `/tmp`:


$ find /tmp -mindepth 3 -type d -print | sed -e 's/\.[^/]*/./g' -e 's/^.* //' -e 's#/##g'
I.01.a.
II.03.d.


The `find` command finds the directories on level 3 and prints out their full path. The result of this step is


/tmp/(1) I. First Majuscule Roman Numeral/01. First Arabic Numeral/a. First Grapheme
/tmp/(2) II. Second Majuscule/03. Third Arabic/d. Fourth


The `sed` command does three things:

1. replaces everything from a dot up until the next slash with a dot, creating

/tmp/(1) I./01./a.
/tmp/(2) II./03./d.


2. removes the bit up until the first space,

I./01./a.
II./03./d.


3. removes the slashes,

I.01.a.
II.03.d.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2a2b64f3e7c4a920c625110d5c2d33f7