Quote:
Originally Posted by
Corona688
Your code isn't Python -- just a transparently-thin shrinkwrapping of Python around 99% pure Bourne shell. I'm not sure why you bothered.
Even for shell code this is atrocious, though. You could do this in one awk call instead of umpteen cat's, sed's, tr's, grep's, and kitchen sinks.
I tried to figure out how many extra processes you're wasting, but I lost count. This is going to be extraordinarily, noticeably slow and wasteful, even on a modern computer. Please, seriously consider rewriting this properly, either using native Python features or properly in the shell.
Hi Corona688,
Thanks for your candid opinion, much appreciated. Am still a beginner, I have no programming experience, am just learning on my own via tutorials on the internet.
Be it as it may, my challenge remains "How do I optimize this code seeing that the input file alone from EXPECT statement is over 800 lines and I need to extract about 20 to 30 variables (KPI values) from it".
And I discovered that writing equivalent code for the CAT command in python will use more lines of code?
Or if anyone else has idea, I will appreciate it.
@disedorgue --- I will also check your opinion, thanks for taking time out to suggest an idea.