Hello, this is probably another really simple tasks for most of you gurus, however I am trying to make a script which takes an input, greps a specific file for that input, prints back to screen the results (which are directory names) and then be able to use the directory names to move files. Something like;
read -p "Enter Comp ID: " id
grep $id /usr/local/test/service/bin/services.sh | grep DEST_PREFIX | grep -v "#"| awk -F/ '{print $2}' | sort -u > clients
cp /data/new/* /var/tmp/"$clients"/inbound
So basically everything in the /data/new directory will get copied to all the folders the grep results bring back - if that makes sence.
Can anyone advise on the best way of doing so?
Thank you in advanced.