By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

help with date extension file reading

P: 9
Hi,

I need help with the script below, the if statments are fine they work perfect. what i am looking for is getting the files from the directory /raw/ with the restriction. for example, the filenames under /raw/ directory are,
[HTML]abc.bb.20060101.gz
abc.bb.20060102.gz
abc.bb.20080101
abc.bb.20080104[/HTML]I want to get all the files less than the date i type in command line. Also should adapt the script below.
before this modification i was passing the dates through a perl script, which allow the script to process one by one file. where $1 was date passed one at a time.
Any help will be appreciated.
thank you in advance.

[HTML]#!/usr/bin/bash
echo $1;
ls /raw/abc.bbx.* | while read filename ; do
i dont know what to do next here.
if test -e /raw/abc.bb.$1;
then
cat /raw/abc.bb.$1 | grep "CN Some" | awk 'NF > 4' >> parsebb.out.1;
fi
if test -e /raw/abc.bb.$1.gz;
then
gunzip -c /raw/abc.bb.$1.gz | grep "CN Some" | awk 'NF > 4' >> parsebb.out.1;fi

if test -e parsebb.out.1
then
`tac parsebb.out.1 > tmpparsebb.out.1`;
fi[/HTML]Also is it possible to redirect the file in same file for "tac" or overwriting the file. I have other option to create temp file, but i dont want to create temp file. please help.
Thanks in advance
John
Feb 27 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.