|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> Heh. I didn't know the shell could do that either. (Although you didn't
> specify *which* shell - Unix has several...)
I don't think there's a unix shell in existence that doesn't do file name
pattern expansion. It would be a rather useless shell if it didn't.
The shell doing the expansion rather than the program is a rather clever
idea. In DOS it was always the program which did the expansion, which meant
that many programs didn't support expansion patterns because the programmers
were lazy. It's also handy because a more advanced shell can support more
complex expansion patterns without the need for the programs to support them.
The program just ends up seeing a bunch of file names in the command line
(because the shell expands them before even launching the program).
> 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.
> 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.
> I never have 50 small files.
Haha. You are quite humorous sometimes.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |