![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> Um... why? Three lines of text doesn't take "minutes" to write. And
> that's about all it takes to search a folder for a file matching a
> condition. (Obviously, it depends on how complicated the condition is...)
How long does it take you to write a program which does the same thing
as this:
fgrep '#include "header.hh"' *.cc
How long does it take to write the program *and* compile it *and* run it?
Why would you do that when you *already* have a program which does that
(namely 'grep')?
And I didn't even use any wildcards there.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> 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...
>
> Talk about an overly complicated solution for a simple problem.
Once the data is in a real database, you can sort it and search it and
compute stats on it and basically do whatever you want with it,
effortlessly and easily. But sure, if you *only* wanted to quickly see
if a particular IP address appears or something, you could use a text
search. But if I was hunting through web logs, I'd probably want to
build all sorts of statistics or do multi-way searches - the exact task
that databases are especially designed to perform. Why not use the right
tool?
>> 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.)
>
> Writing something like "grep 'hello.*there' file.txt" doesn't require a
> lot of time or thinking.
Nor does opening file.txt in a text editor and running a quick search.
(Not that I can think of a reason to want to do this in the first place...)
>> Personally I just dislike scripting languages.
>
> What's the difference between "a scripting language" and "a real language"?
Now that is surprisingly hard to pin down. ;-)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Warp wrote:
> Invisible <voi### [at] dev null> wrote:
>> Um... why? Three lines of text doesn't take "minutes" to write. And
>> that's about all it takes to search a folder for a file matching a
>> condition. (Obviously, it depends on how complicated the condition is...)
>
> How long does it take you to write a program which does the same thing
> as this:
>
> fgrep '#include "header.hh"' *.cc
>
> How long does it take to write the program *and* compile it *and* run it?
> Why would you do that when you *already* have a program which does that
> (namely 'grep')?
>
> And I didn't even use any wildcards there.
OK, fair enough. I guess we'll just put this one down as "I personally
have never ever needed to do this" then.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> > Writing something like "grep 'hello.*there' file.txt" doesn't require a
> > lot of time or thinking.
> Nor does opening file.txt in a text editor and running a quick search.
It requires a lot more time, especially if you want to do it for more than
one file. It's you who was talking about "using the right tool".
> (Not that I can think of a reason to want to do this in the first place...)
You are now being stubborn as a matter of principle. I gave you one example
and you admitted that the example was sensible, and even gave an alternative
solution to the same problem (by using a database), and now you are again
repeating the "I can't think of a reason to do this" nonsense.
> >> Personally I just dislike scripting languages.
> >
> > What's the difference between "a scripting language" and "a real language"?
> Now that is surprisingly hard to pin down. ;-)
I think you are simply being prejudiced.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> OK, fair enough. I guess we'll just put this one down as "I personally
> have never ever needed to do this" then.
I don't think that's true. You said that you would use a text editor to
search for specific lines. That means you *know* that you can use a text
editor for that purpose. If you know that, you have probably done it,
probably many times.
You are just being stubborn and arguing for the sake of argument.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>> Writing something like "grep 'hello.*there' file.txt" doesn't require a
>>> lot of time or thinking.
>
>> Nor does opening file.txt in a text editor and running a quick search.
>
> It requires a lot more time, especially if you want to do it for more than
> one file. It's you who was talking about "using the right tool".
If you have lots of files to search then yes, I guess you don't want to
open each one in a text editor just to search it. (Again, not something
I've ever needed to do.)
>> (Not that I can think of a reason to want to do this in the first place...)
>
> You are now being stubborn as a matter of principle. I gave you one example
> and you admitted that the example was sensible, and even gave an alternative
> solution to the same problem (by using a database), and now you are again
> repeating the "I can't think of a reason to do this" nonsense.
I can't think of a reason to search a text file for "hi there". Maybe
I'm just looking at this too narrowly. As I say, in the kinds of tasks I
do, I almost never need to search for things. (E.g., I don't run a web
server.) So maybe that's why it doesn't seem so vital to me.
>>>> Personally I just dislike scripting languages.
>>> What's the difference between "a scripting language" and "a real language"?
>
>> Now that is surprisingly hard to pin down. ;-)
>
> I think you are simply being prejudiced.
There are languages which are designed for quickly throwing together
small scripts, and there are languages designed for building large-scale
applications. There's no sharp dividing line between them, but they
exist. I tend to prefer the latter; scripting languages tend to be a tad
messy and ad hoc, and many of them try to be too helpful and end up
getting in your way. Still, if the task you're trying to perform really
*is* small, sometimes scripting can be the best way.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>> OK, fair enough. I guess we'll just put this one down as "I personally
>> have never ever needed to do this" then.
>
> I don't think that's true. You said that you would use a text editor to
> search for specific lines. That means you *know* that you can use a text
> editor for that purpose. If you know that, you have probably done it,
> probably many times.
Not nearly as many times as you seem to think.
> You are just being stubborn and arguing for the sake of argument.
Well, I could have stood here claiming that "no, you must be wrong".
Instead I said "OK, maybe it's just that you use computers for different
tasks than me". Doesn't sound to me like somebody who's *trying* to
cause an argument. (If anything, your comment sounds more argumentative...)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> (Again, not something I've ever needed to do.)
Do you know what I'm thinking? I'm thinking that you have been in
situations where searching something on a bunch of files would have
been useful, but since you didn't know how, you just skipped it and
forgot about it. Or you perhaps used some really complicated way of
doing it and then forgot about it.
> I can't think of a reason to search a text file for "hi there".
OMG. Do you understand the concept of an example?
Besides, I already gave *real* examples in a previous post (related to
httpd logs). You acknowledged the usefulness, but naturally are now
forgetting about it, for whatever reason I cannot understand.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Invisible <voi### [at] dev null> wrote:
> >> OK, fair enough. I guess we'll just put this one down as "I personally
> >> have never ever needed to do this" then.
> >
> > I don't think that's true. You said that you would use a text editor to
> > search for specific lines. That means you *know* that you can use a text
> > editor for that purpose. If you know that, you have probably done it,
> > probably many times.
> Not nearly as many times as you seem to think.
That's quite different from "never needed to do this".
You are seriously telling me you have never used the search feature of
a program which handles text?
> > You are just being stubborn and arguing for the sake of argument.
> Well, I could have stood here claiming that "no, you must be wrong".
> Instead I said "OK, maybe it's just that you use computers for different
> tasks than me". Doesn't sound to me like somebody who's *trying* to
> cause an argument. (If anything, your comment sounds more argumentative...)
How hard is it to say "yes, I see how 'grep' or similar tools can be
very useful"? Instead, you keep repeating "I have never needed anything
like that", making it sound like in your opinion it must be one of the
most useless things in existence.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
>>>> OK, fair enough. I guess we'll just put this one down as "I personally
>>>> have never ever needed to do this" then.
>>> I don't think that's true. You said that you would use a text editor to
>>> search for specific lines. That means you *know* that you can use a text
>>> editor for that purpose. If you know that, you have probably done it,
>>> probably many times.
>
>> Not nearly as many times as you seem to think.
>
> That's quite different from "never needed to do this".
>
> You are seriously telling me you have never used the search feature of
> a program which handles text?
I do occasionally do a find & replace over a file to rename an
identifier. Not particularly often though. I can't remember the last
time I needed to perform just a normal search.
(Although I'll admit I sometimes end up needing it on web pages. Like, I
google something, and the page that comes back doesn't appear to contain
my search term anywhere, so I do a text search for it.)
> How hard is it to say "yes, I see how 'grep' or similar tools can be
> very useful"? Instead, you keep repeating "I have never needed anything
> like that", making it sound like in your opinion it must be one of the
> most useless things in existence.
The fact that "grep" is used within certain circles as if it's an actual
English verb makes it clear that somebody thinks it's useful. I'm just
puzzled as to what the attraction is, that's all.
From what's happened in this discussion, it seems that it's just that
other people work with far more text files than I do.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |