#!/usr/bin/python
# -*- coding: utf-8 -*-

# --------------------------------------------------
# File Name: renameFiles.sh
# Location: 
# Purpose:
# Creation Date: 25-01-2018
# Last Modified: Thu, Jan 25, 2018  2:31:17 PM
# Author(s): Mike Stout 
# Copyright 2017 The Author(s) All Rights Reserved
# Credits: 
# --------------------------------------------------

SAVEIFS=$IFS

IFS=$(echo -en "\n\b")

for f in `cut -d, -f1,4 lut_1.csv | grep xml | grep Tit `
do 

g=`echo $f | cut -d, -f1`
h=`echo $f | cut -d, -f2 | sed -e 's/\(F\|Q\)[0-9]*$/_&/' `
p=`echo $h | cut -d_ -f1`



cp GE_16.1.18/$g FILES_USED/${h}_Full.xml

mkdir $p
cp GE_LUTs_19.1.18/${p}* $p/
cp FILES_USED/${p}* $p/

mv $p PLAYS/

done

IFS=$SAVEIFS