#!/bin/bash

ls -l ../*/diameters_albedo/family.list | awk '{ print gensub("../([^/]*).*","\\1",1,$9) "/" gensub("../(.*)","\\1",1,$11); }' > ls.out

for FILE in `cat ls.out` ; do

  NAME=`echo $FILE | awk 'BEGIN{ FS="/"; }{ split($1,l,"_"); print l[2]; }'`
  OUT=`echo $FILE | awk '{ gsub("/", "_"); print; }'`
  echo "$NAME $OUT";
  awk -vNAME=$NAME '{ print $0 "	" NAME; }' < ../$FILE > $OUT

done


