^thehatsrule^
Group: Members
Posts: 3275
Joined: July 2006 |
|
Posted: Jan. 29 2008,17:29 |
|
Quote | I have to say that I was a bit surprised. =) I ran that many times. Times got a bit different each time, but for loop+case won each time. | That's not too surprising actually... in your many cases script it continously passes all the arguments and looks through all of them each time, whereas the for loop implementation doesn't have wildcards in the case statement and only compares one parameter at a time. And having a loop like that seems to be pretty common to me.
Quote | I would also like to replace sed with awk if it can perform search & replace easily, like sed. | I'd stick with sed because it should be a 'lighter' binary (unless you have some reason to worry about having a missing sed)
Also, if you can, avoid using search and replace at all if possible. For example, looking at your code in your first post, you can make a function that can print the output from variables instead of replacing the text in OUTPUT_FORMAT.
|