|
|
In article <3f670e1a$1@news.povray.org>,
"Steve Shelby" <ssh### [at] rexnetnet> 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
#!/usr/bin/perl
while ($ARGV[0] =~ /^-(start|end)=([0-9]+)/) {
$cmd = $1;
$number = $2;
if ($cmd eq 'start') {
$startline = $number;
} else {
$endline = $number;
}
shift;
}
while (<>) {
$line++;
print if ($line >= $startline && ($endline<= 0 || $line <= $endline));
}
Save it as "clip" and ensure however you do so for your OS that it is
executable.
Use as (on Unix)
clip -start=xx -end=xx filename
On Mac OS X, for example, I might use:
clip -start=8605 -end=17361 meshes.pov | pbcopy
And then I could paste those lines into another document.
On Linux, I might use:
clip -start=8605 -end=17361 meshes.pov > wantedmeshes.pov
to put those lines into a file called "wantedmeshes.pov"
I don't know the syntax for using perl on Windows, but it would probably
be similar.
Leave out -start to start at the beginning, and leave out -end to go to
the end. You can do multiple files, but it will start counting from the
first file and continue on counting through subsequent files, which
probably isn't generally what you want.
Jerry
--
"Give a man a fish and you feed him for a day. Teach him to fish, and you've
depleted the lake."--It Isn't Murder If They're Yankees
(http://www.ItIsntMurder.com/)
Post a reply to this message
|
|