site-neo/awk/getsd.awk

8 lines
172 B
Awk

#!/usr/bin/awk
BEGIN{FS="/";x=2}
function none() {print "main";exit}
NF==1{none()}
/\.\//{x++}
$x~/\.(txti|html|org|md)/{none()}
{if($x=="dnd")none();else {print $x;exit}}