删除 povray 文件中带有内部标志的多行文本块
我有一个 pov-ray 文件,它定义了很多圆柱体和球体。有时,这些形状被定义为具有“color@”,这使得 povray 无法渲染。我发现的一种解决方案是删除有问题的圆柱体和球体。因此,包含此文本的文件
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 }
}
将变成此文本
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 }
}
有没有某种方法可以使用 shell 脚本进行此替换?最好在 tcsh 中。谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该可以解决问题,前提是您提供的示例是准确的 - 即“颜色”之前的 2 行和“颜色”之后的 1 行是描述您需要的行。
This should do the trick, providing the example you supplied is exact - i.e. 2 lines before 'color' and 1 line after 'color' are the lines which describe what you need.