POV-Ray : Newsgroups : povray.off-topic : Context switching : Re: Context switching Server Time
5 Sep 2024 01:22:55 EDT (-0400)
  Re: Context switching  
From: Jim Henderson
Date: 22 Apr 2010 16:00:00
Message: <4bd0aac0$1@news.povray.org>
On Thu, 22 Apr 2010 09:12:03 +0100, Invisible wrote:

>>> I throught that grep is an overly-complicated way of searching for the
>>> location of a string within one particular file? (I usually just use
>>> my text editor's "search" function.)
>> 
>> Does your editor support regular expressions?   Most only support a
>> simple substring search.
> 
> Is there some advantage to supporting regular expressions?

Yes, because if you don't know the exact string you're looking for, you 
can specify a more general string that is likely to be found.

> I mean, I realise that hypothetically a regex can find things that a
> normal search can't. But in reality, when are you *ever* going to use
> that? What would it be useful for?

I use it several times a week myself, reasons include chat log files in 
my IM client where I might need to find a conversation I've had in the 
past about something.  I recently was trying to remember the name of an 
internal website, but I couldn't remember who I had talked to about it or 
the website name.  I was able to use grep to find what I needed in a 
matter of seconds without searching (checks - "find -type f | wc -l" - 
8694 chat log files across all the different IM protocols I use).

Doing that by hand would be very tedious and would take days, and even 
then, I might not find what I was looking for.

>> As Warp said, you also can traverse a directory structure with grep to
>> find the file(s) that have the string in them.
> 
> I didn't know that. I thought grep was just for searching within one
> file.

If I tell you the 'net is wonderful resource for information, what will 
you say in response?  ;-)

Jim


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.