POV-Ray : Newsgroups : povray.off-topic : Context switching : Re: Context switching Server Time
5 Sep 2024 05:22:33 EDT (-0400)
  Re: Context switching  
From: Warp
Date: 22 Apr 2010 06:13:31
Message: <4bd0214b@news.povray.org>
Invisible <voi### [at] devnull> wrote:
> No, I mean... I thought grep can only search within a single file (as 
> can any decent text editor). I didn't realise it can search multiple files.

  You tell it which files it should search, like:

    grep 'abc' file1.txt file2.txt file3.txt

  Of course if you are in a command line shell, you can use the shell to aid
you in specifying more files by using a pattern, eg:

    grep 'abc' file*.txt

  (Note that it's the shell that expands the pattern to actual file names,
not grep.)

> (I'm still having trouble thinking up a use-case for that. About the 
> only thing I can think of is trying to find out which header file 
> defines a particular symbol or something.)

  'grep' is one of the most used utilities in Unix systems. It's quite handy
for many, many things. The reason why it's useful is because as it prints
the found results to stdout, you can pipe them to something else, which may
then do something with those results, and so on. Using 'grep' as part of such
a chain of commands is pretty common.

  Of course 'grep' is useful all in itself as well, if you want to find files
which contain a certain string.

> >> I guess I don't very often edit large files...
> > 
> >   What does file size have to do with anything?

> If it's a small file, you can search it just be scrolling through it and 
> looking with your eyes. You don't need an automated search facility. The 
> only real reason to use an automated search is if there's too much data 
> to hunt through manually.

  What if you have 50 small files?

-- 
                                                          - Warp


Post a reply to this message

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