In UNIX this is of course swoosh, its
tail -f logfile | grep -v pattern >> outfile
Alas running on my Windows desktop Microsoft in its wisdom sees no need of such conveniences like tail and grep.
So what to do? Of course, what I did back at SupportSoft when I had to deal with this. Write a Python script to tail and grep. It was pretty easy since there was already stuff on the Internet for that - of course in Python it was only about three lines anyway. And just like that I was in business, no more annoying periodic log messages.
It was a bit strange though when I went to write the script. I was surprised to notice that I didn't even have Python installed on my desktop. That's weird, have I really gone that long without it? Maybe since I switched jobs close to a year ago it takes a while to properly get settled in and comfortable to the point of firing up Python to make your day more productive and enjoyable. Plus I've switched to a new team recently so maybe the dynamic here is somehow different in some more positive way that steered me back toward my correctness of the past.
Anyway I'm glad to have it. Since then I've had my interpreter up all day long and it's just pleasing to see it there on my taskbar, like an old friend. I even found some more uses for some quick one line things. So welcome back to my desktop Python.
No comments:
Post a Comment