site-neo/awk/getsd.awk

8 lines
172 B
Awk
Raw Normal View History

2023-02-11 11:22:16 -05:00
#!/usr/bin/awk
BEGIN{FS="/";x=2}
2023-02-11 13:00:31 -05:00
function none() {print "main";exit}
NF==1{none()}
2023-02-11 11:22:16 -05:00
/\.\//{x++}
2023-02-11 13:00:31 -05:00
$x~/\.(txti|html|org|md)/{none()}
2023-04-03 16:27:57 -04:00
{if($x=="dnd")none();else {print $x;exit}}