格雷普(Grep)排除评论,如尾巴
我有正则是:
grep -iE 'UTL_FILE[\. ]*(FCOPY|FGETATTR|FOPEN|FOPEN_NCHAR|FREMOVE|FRENAME|fopen)'
我想将其扩展以排除所有以任何数量的with with空间开头的评论,
例如,“ - ”获取下一行(这已经由正则表达式完成):
l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w');
但是忽略这样的行:
--l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w'); or
-- l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w');
I have the regex:
grep -iE 'UTL_FILE[\. ]*(FCOPY|FGETATTR|FOPEN|FOPEN_NCHAR|FREMOVE|FRENAME|fopen)'
And I would like to extend it to exclude all the lines which are comments starting with any number of withe spaces and '--'
For example, get the next line (This is already done by the regular expression):
l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w');
But ignore lines like this:
--l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w'); or
-- l_output := utl_file.fopen(p_RutaLocal, Nombre_Archivo,'w');
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将两个grep一起处理:
-v
选项打印不匹配的行。Pipe two greps together:
The
-v
option prints lines that don't match.建议尝试:
Suggesting to try: