fileformat (433B)
1 #!/bin/rc 2 # 3 # Formats the names of files in my preferred way. 4 # 5 6 fn sigexit { 7 rm $tmp 8 } 9 10 tmp = /tmp/$pid.tags 11 for (f in $*) { 12 tag/get $f > $tmp 13 track = `$nl{grep -i '^track:' < $tmp | sed 's/^[^ ]*: 0*//;s~/.*$~~'} 14 title = `$nl{grep -i '^title:' < $tmp | sed 's/^[^ ]*: //' | tr / '&'} 15 ext = `$nl{echo $f | sed 's/.*\.//' | tr '[:upper:]' '[:lower:]'} 16 dir = `$nl{dirname $f} 17 printf '%s/%02d %s.%s\n' $dir $track $title $ext 18 }