如何执行"grep"搜索,以排除以"//"开头的行及其前面的空格? [英] How to perform a 'grep' search that excludes line starting with "//"and its preceding spaces?

查看:630
本文介绍了如何执行"grep"搜索,以排除以"//"开头的行及其前面的空格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何执行"grep"搜索,该搜索不显示在行首带有注释标记"//"的任何行,而忽略"//"标记前面的空格? >

我尝试了grep your_search_pattern' where_to_look | grep -v '^//,但是它不会忽略在"//"之前有空格的行.

解决方案

 grep 'your_search_pattern' where_to_look | grep -v '^//'

How to perform a 'grep' search which doesn't display any lines that have the comment marks "//" in the front of the line, but also ignore whitespace in front of the "//" marks?

I attempted grep your_search_pattern' where_to_look | grep -v '^//, but it does not ignore lines that have spaces before "//".

解决方案

 grep 'your_search_pattern' where_to_look | grep -v '^//'

这篇关于如何执行"grep"搜索,以排除以"//"开头的行及其前面的空格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆