i have a input file say temp.txt with content as following
2013-08-13 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-03-01
2013-08-14 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-03-02
2013-08-15 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-03-03
2013-07-30 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-07-30
2013-07-31 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-07-31
2013-08-16 /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-08-13
I need to iterate over this file and create directories with the date specified at the begining of the line and then move the data in the directory specified after the date to this particular directory..
for example: for first line i need to do a
mkdir "2013-08-13"
and then
mv /data/PSG/LZ/INVENTORY_FORECAST/load_date=2013-03-01/ 2013-08-13
i am trying to do it with
cat temp.txt | while read line ; do mkdir "echo $line | awk '{print $0}'"; done;
tried to use line as a array using
cat temp.txt | while read line; do lineArray=($line) echo $line, ${lineArray[0]}, $lineArray[1]; done;
but none of these seem to work.. any idea about how to approach this problem ?
echo "echo $line | awk '{print $0}'";