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