delete multi-line block of text with internal flag in povray file

Posted by Sibo Lin on Stack Overflow See other posts from Stack Overflow or by Sibo Lin
Published on 2010-05-10T12:02:45Z Indexed on 2010/05/10 13:54 UTC
Read the original article Hit count: 259

Filed under:
|
|

I have a pov-ray file, which defines a lot of cylinders and spheres. Sometimes these shapes are defined to have "color@", which makes the povray unrenderable. One solution I've found is to delete the offending cylinders and spheres. So a file that contains this text

 cylinder {
<    -0.17623,     0.24511,    -0.27947>, <    -0.15220,     0.22658,    -0.26472>,      0.00716
 texture { colorO }
 }
sphere { 
<    -0.00950,     0.00357,     0.00227>,      0.00716
 texture { color@ }
 }
 cylinder {
<    -0.00950,     0.00357,     0.00227>, <     0.00327,     0.00169,     0.00108>,      0.00716
 texture { color@ }
 }
sphere { 
<     0.15373,     0.00601,     0.18223>,      0.00716
 texture { colorO }
 }

would turn into this text

 cylinder {
<    -0.17623,     0.24511,    -0.27947>, <    -0.15220,     0.22658,    -0.26472>,      0.00716
 texture { colorO }
 }
sphere { 
<     0.15373,     0.00601,     0.18223>,      0.00716
 texture { colorO }
 }

Is there some way to do this replacement with a shell script? Preferably in tcsh. Thanks!

© Stack Overflow or respective owner

Related posts about tcsh

Related posts about multiline