[email protected] wrote:
> Chloe,
>
> Like Jim says, you should use the OS to do this.
Using SELECT and DELETE (not DELETE-FILE) will work fine, it just won't
be very fast.
> The &COMO& file is
> an OS level directory. If you are running jBASE under Windows (you
> didn't give enough info for this), then you can simply use Windows
> Explorer to sort the directory by date modified and then remove the
> records you don't want.
>
> I am not a guru on Unix, but you could use a grep to find all these
> files also.
>
The problem with grep:
grep -lv "MAY" \&COMO\&/*
Is that it won't limit itself to the first line, so it will preserve
anything that contains MAY anywhere. Awk is much better:
find \&COMO\& | xargs awk '(NR == 1) && /MAY/ { print FILENAME }' |
xargs rm
And if you make a script:
#! /bin/bash
FILES=$(find \&COMO\& | xargs awk '(NR == 1) && /$1/ { print FILENAME }')
for $F in $FILES
do
echo "Deleteing log file ${F}"
rm $F
done
You can run it with arguments ($1 is the first script argument). It is
possible to do all of that entirely in awk of course.
Jim
--~--~---------~--~----~------------~-------~--~----~
Please read the posting guidelines at:
http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to
Globus/T24
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en
-~----------~----~----~----~------~----~------~--~---