> How about 
>    cat log|grep -v -E [[:alnum]]'{2096}'>> log.bak

OK< but you can miss the cat out

grep -v -E [[:alnum]]'{2096}' log >> log.bak

But I confess I've no idea how that works, I've never 
seen that notation in a grep before! Checking man reveals 
an "extended regex" which I interpret as:

any alphanumeric repeated 2096 times?
But I'm not sure about my interpretation...

> The issue is - will unix shell command be any more
> efficient than a python script??

Usually, if you only use a single process like grep 
because they are written in C. But when you pipeline 
with cat it might slow it down enough to make Python 
competitive. Process startup tends to be the limiting 
factor in shell pipelines.

> Also i used append because i gathered that the user
> will not want to erase the previous logs. He is free
> to use a single > if he does.

Interesting, I assumed he would want to delete the 
old logs... As you say, whichever is appropriate is 
easily controlled.

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to