|
 |
Warp wrote:
> The shell doing the expansion rather than the program is a rather clever
> idea.
Yeah. But then, it's part of the general Unix philosophy of "make each
tool do one job, and one job well".
With MS-DOS/Windows, the shell's job is basically to launch the
interactive programs that do all the *real* work. The shell itself is
pretty poor. (Although not quite as poor as it seems at first...)
>> I'm still not seeing what's so useful about being able to search a file
>> for something.
>
> Suppose that you have a httpd log file and you want to list all entries
> within a specific day. Or the number of requests for a specific file (or
> a group of files). Suppose you want to list all entries *except* those
> which match a certain pattern (eg. they have a referrer which indicates
> that the request was made by a search engine). 'grep' is your tool for that.
Ah, right. I see.
Personally, I'd import the whole log into a relational database, and
process it that way. (Or maybe even use a webserver that keeps its logs
in a database in the first place, rather than a huge flat file.) But
apparently that's just me...
>> Now, I suppose if you were trying to script something, being able to
>> pipe output from another command into grep so that it can grab a
>> particular substring that you can then pipe to something else might be
>> useful. But then, if *I* wanted to do something like that, I wouldn't
>> script it. I'd write a real program, not a script.
>
> Filtering some files through a chain of programs (such as grep and sed)
> takes just a few seconds of writing a few commands on the command line.
> Writing a program to do that would probably take a hundred times longer.
On the contrary, figuring out how to work grep vs writing a program in a
language I already know well is likely to take *slightly* more than
merely a hundred times longer. (Although you could argue that's a
one-time cost.)
Personally I just dislike scripting languages. I'd rather use a real
language with propper error checking and so on and so forth. But I guess
that's just me.
>> I never have 50 small files.
>
> Haha. You are quite humorous sometimes.
Maybe I just don't try to do the same kinds of tasks as you?
Post a reply to this message
|
 |