Quote:
I'm not sure why you seem to despise it.
Mainly because it does not correctly deal with input lines containing space characters and it is can easily break the maximum command line length in common Operating Systems such as IBM's AIX.
As a troubleshooter since early unix I found that script authors using "for" with open-ended lists proved to be the most common scripting mistake. I've even seen it in manufacturer-supplied cleanup crons in Unix SV R3 .
I have no problem for with finite lists with the values in double quotes. The issue is with open-ended lists.
Btw. Your script would run a lot faster if you test the result of the unix "file" command first to eliminate non-ascii files which are unsuitable for a character string "grep". I have used this technique to search over 100,000 files where only about 2,000 were suitable for searching.
Afterthought: The matching process would be a lot quicker with "egrep" on a file-by-file basis.