POV-Ray : Newsgroups : povray.newusers : selecting several thousand lines in pov file Server Time
30 Jul 2024 18:11:34 EDT (-0400)
  selecting several thousand lines in pov file (Message 1 to 8 of 8)  
From: Steve Shelby
Subject: selecting several thousand lines in pov file
Date: 16 Sep 2003 09:22:19
Message: <3f670e8b$1@news.povray.org>
Hi,
Is there an easier way to do this? I have about 9,000 lines, one of several
mesh2 objects, in a pov file, that I want to select in order to copy and
paste to another pov file, which also contains several mesh2 objects. The
only would I know to do this is to start selecting and scroll, and scroll,
and scroll.......and scroll until an eternity later I finally have the whole
thing selected. It seems like one ought to be able to tell Povray to "select
from line 8605 to line 17361" and it would be done, but I can't find any way
to do that, nor can I find anything in the documentation about it. Am I
stuck doing it the hard way?
Steve Shelby


Post a reply to this message

From: Christoph Hormann
Subject: Re: selecting several thousand lines in pov file
Date: 16 Sep 2003 09:52:12
Message: <a4hj31-pvj.ln1@triton.schunter.etc.tu-bs.de>
Steve Shelby wrote:
> Hi,
> Is there an easier way to do this? I have about 9,000 lines, one of several
> mesh2 objects, in a pov file, that I want to select in order to copy and
> paste to another pov file, which also contains several mesh2 objects. The
> only would I know to do this is to start selecting and scroll, and scroll,
> and scroll.......and scroll until an eternity later I finally have the whole
> thing selected. It seems like one ought to be able to tell Povray to "select
> from line 8605 to line 17361" and it would be done, but I can't find any way
> to do that, nor can I find anything in the documentation about it. Am I
> stuck doing it the hard way?
> Steve Shelby
> 
> 

cat mesh2.pov | head -n 17361 | tail -n `expr 17361 - 8605`

;-)

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 17 Jun. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Warp
Subject: Re: selecting several thousand lines in pov file
Date: 16 Sep 2003 10:51:21
Message: <3f672364@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> cat mesh2.pov | head -n 17361 | tail -n `expr 17361 - 8605`

  Useless use of cat...
  'cat' is a command for catenating files (the counterpart of 'split').
Catenating one file with nothing makes no sense at all.

  The good-style way of doing it is:

head -n 17361 mesh2.pov | tail -n `expr 17361 - 8605`

  However, that command still has useless junk. You can do it like this:

head -17361 mesh2.pov | tail +8756

(if you want to keep the calculation, you can do it more efficiently like
this, at least in zsh:
head -17361 mesh2.pov | tail +${17361-8605}
)


-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Christoph Hormann
Subject: Re: selecting several thousand lines in pov file
Date: 16 Sep 2003 11:12:02
Message: <3olj31-pms.ln1@triton.schunter.etc.tu-bs.de>
Warp wrote:
> 
> head -n 17361 mesh2.pov | tail -n `expr 17361 - 8605`
> head -17361 mesh2.pov | tail +8756
> head -17361 mesh2.pov | tail +${17361-8605}

Not using -n is not a documented feature AFAIK and my version IMO is 
much better to understand for someone not so fluent in shell programming.

Concerning use of 'cat' - of course it is never necessary to use it for 
one file but it produces much more readable code in many situations, 
especially if the program used requires the stuff from stdin (and you 
would have to use 'program < mesh2.pov').

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 17 Jun. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Warp
Subject: Re: selecting several thousand lines in pov file
Date: 16 Sep 2003 12:10:28
Message: <3f6735f4@news.povray.org>
Christoph Hormann <chr### [at] gmxde> wrote:
> Concerning use of 'cat' - of course it is never necessary to use it for 
> one file but it produces much more readable code in many situations, 
> especially if the program used requires the stuff from stdin (and you 
> would have to use 'program < mesh2.pov').

  Whether

cat file | program options

  is more readable than

program options file

  is a question of taste. The upper version can be very confusing to
people who don't know what cat does, what a | does and why the program
doesn't seem to be taking any file at all, while the second one seems
more clear.
  Besides, the latter is easier to write.

  Just a question: Why teach newbies wrong habits from the start? Why not
teach them good habits to begin with?

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Michael W A Farmer
Subject: Re: selecting several thousand lines in pov file
Date: 8 Nov 2003 13:53:08
Message: <3fad3b94$1@news.povray.org>
I think you may be confusing "catenate" with "concatenate". Catenating one
file is perfectly valid.

"Warp" <war### [at] tagpovrayorg> wrote in message
news:3f672364@news.povray.org...
> Christoph Hormann <chr### [at] gmxde> wrote:
> > cat mesh2.pov | head -n 17361 | tail -n `expr 17361 - 8605`
>
>   Useless use of cat...
>   'cat' is a command for catenating files (the counterpart of 'split').
> Catenating one file with nothing makes no sense at all.
>
>   The good-style way of doing it is:
>
> head -n 17361 mesh2.pov | tail -n `expr 17361 - 8605`
>
>   However, that command still has useless junk. You can do it like this:
>
> head -17361 mesh2.pov | tail +8756
>
> (if you want to keep the calculation, you can do it more efficiently like
> this, at least in zsh:
> head -17361 mesh2.pov | tail +${17361-8605}
> )
>
>
> -- 
> #macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb
x]
> [1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
> -1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// -
Warp -


Post a reply to this message

From: Warp
Subject: Re: selecting several thousand lines in pov file
Date: 8 Nov 2003 14:30:44
Message: <3fad4464@news.povray.org>
Michael W A Farmer <mwa### [at] blueyondercouk> wrote:
> I think you may be confusing "catenate" with "concatenate". Catenating one
> file is perfectly valid.

From Webster's Revised Unabridged Dictionary (1913) [web1913]:

  Catenate \Cat"e*nate\, v. t. [imp. & p. p. {Catenated}; p. pr. &
     vb. n. {Catenating}.] [L. catenatus, p. p. of catenare, fr.
     catena chain. See {Chain}.]
     To connect, in a series of links or ties; to chain. --E.
     Darwin.

From WordNet (r) 2.0 [wn]:

  catenate
       v : arrange in a series of rings or chains, as for spores [syn:
           {catenulate}]


  You need at least two objects to catenate them. You can't catenate
one object.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Jarno Parmonen
Subject: Re: selecting several thousand lines in pov file
Date: 20 Nov 2003 09:25:21
Message: <3fbcced1$1@news.povray.org>
Why everybody seems to be doing it the hard way... simply click on the 
start of the first line of code, so that the cursor blinks over there. 
then scroll down to the end of code which you want to copy. press down 
Shift and click with mouse. And presto you have the code selected!


Post a reply to this message

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