This more complicated version would work for ten or more folders deep. Don't use this one unless you think you will actually need it, because it's pretty complicated and the guy who wrote it was probably just showing off or bored that he wasn't at .conf or something.
| rename COMMENT as "Pull out the other members"
| rex "(OU|CN)=(?<OU>[^,$]*)" max_match=0
| rename COMMENT as "Create a range of 2-digit numbers, then attach each member to a number so that we can sort them.."
| rename COMMENT as "This complex version will NOT fail if there are more than 10."
| eval sorter =mvjoin(mvrange(0,mvcount(OU)),",")
| rex mode=sed field=sorter "s/^(\d)/0\1/g s/(?<=,)(\d)(?=[,])/0\1/g s/(?<=,)(\d)$/0\1/g"
| eval sorter=mvzip(split(sorter,","),OU,"/")
... View more