#!/bin/bash

for file in $(ls *.txt *.lst) ; do
    if grep -q / $file ; then
        echo $file
        echo -n > $file.new
        while read line ; do
            eval set $line
            img=$(basename $1)
            shift
            echo "$img $*" >> $file.new
            #cat $file | awk '{system("echo -n `basename "$1 "`; printf %s\n "$1)}' > $file.new 
        done < $file
        cp -f $file.new $file
        rm $file.new
    fi
done
