Insert Date timestamp from .gz files.
Hello Friends,
I have an inquiry where i have a directory of .gz files.
rw-r--r-- 1 Wootie Wootie 175 Sep 2 00:30 bk.2012.09.01.gz
-rw-r--r-- 1 Wootie Wootie 20311 Sep 3 00:30 bk.2012.09.02.gz
-rw-r--r-- 1 Wootie Wootie 534140 Sep 4 01:00 bk.2012.09.03.gz
The files do not have timestamps in them and i'm trying to figure out a way to insert the associated timestamp to the correct file into one file.
So the output would be something as such from reading bk.2012.09.01.gz
Sep 2
83.60300,0/4750000,2459405781485463,83.603@0
83.60300,0/4750000,2459405781485463,83.603@0,
Sep 3
83.60300,0/4750000,2459405781485463,83.603@1
83.60300,0/4750000,2459405781485463,83.603@1
I have tried this but to no avail.
#!/bin/bash
cd ~tech/reports/production
TIMESTAMP=$(ls -l | grep -i bk.2012.09 |awk '{print $6,$7}')
FILE="/home/resource/public_html/reports/production/bk.2012.09*.gz"
while IFS= read -r line
do gunzip -c $line |grep -i alphamale > /tmp/test.xls
done <"$FILE"
Please assist,
Regards,
Liketheshell
|