in reply to Re^2: Code Efficiency: Trial and Error?
in thread Code Efficiency: Trial and Error?

I didn't do the file globbing outside of the perl script because that seemed to be slower, and a readdir solution seemed to be faster than a glob inside of the script. I corrected and rewrote your shell solution for Korn:
for ALIAS in * do [[ $(sed -n 's/^Customer Code.* // t done d : done p q' "$ALIAS") = $code ]] && break done print $ALIAS
But this seems to be the slowest solution of all. Probably due to having to fire up a sed process so many times, and maybe also due to the specific regex. But like I say in my reply to Abigail-II's post above, I'll probably end up with grep -l just for the simplicity of it.

Update: In addition to Aristotle's updated note's, another sign is that if you pipe grep to or from sed, awk, & maybe even cut, you are probably doing too much work, and may be better off just using one of the aforementioned commands instead.