POV-Ray : Newsgroups : povray.off-topic : Context switching : Re: Context switching Server Time
4 Sep 2024 17:24:27 EDT (-0400)
  Re: Context switching  
From: Warp
Date: 24 Apr 2010 04:36:44
Message: <4bd2ad9c@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> Or rather, I'd rather write my own program than use grep for a *complex* 
> search. (E.g., find anything that's a valid XML fragment.)

  Don't start making unfair comparisons. 'grep' (as well as other similar
tools such as 'sed') is a line-based tool. It can match individual *lines*
of the input. It cannot be used to perform operations which would require
interpreting several lines (unless it has some non-standard extensions).

  Recognizing a valid XML fragment would require interpreting several lines
of the input (if you want to be able to match all possible cases), and hence
'grep' cannot be used for that.

  'grep' is most useful for finding things you know are all in one line,
and for filtering files with a known format (such as httpd logs).

  If you need more complicated things like that, then often 'awk' or 'perl'
can be used (still usually with shorter commands and faster than writing
your own program would). For example 'perl' can be used for the same things
as 'grep' and 'sed', but it has a vastly expanded set of match patterns and
other instructions.

-- 
                                                          - Warp


Post a reply to this message

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