如何执行忽略注释掉的行的grep? [英] How to perform a grep which ignores commented out lines?

查看:131
本文介绍了如何执行忽略注释掉的行的grep?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何执行一个'grep'搜索,它不会显示任何在行前有注释标记//的行,但也会忽略//标记前面的空格

I was wondering 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?

我正在使用grep*,但我不知道如何不使用-v标志来搜索某些内容,我尝试了但没有成功。 / p>

I am using grep "" *, but I don't know how to not search for something using the -v flag, I tried but it didn't work.

推荐答案

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

这篇关于如何执行忽略注释掉的行的grep?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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