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 |
Something like this?
Code:
SRCPATH="/home/resource/public_html/reports/production" |
Quote:
Unspawn, i will try your suggestion and many thanks for the feedback. The only inquiry i do have is the timestamp needs to come from the time the file(s) where created and not the current system time. I will give it a go though. Many Thanks, Alfred (Liketheshell)... :) |
All times are GMT -5. The time now is 06:54 PM. |