LINUX中,find结合grep正则表达式,快速查找代码文件。

本文介绍如何在LINUX环境中使用find结合grep正则表达式快速查找特定代码片段的方法。例如,查找所有.h文件中以public开头并以VideoFrameReceiver结尾的字符串。通过实际案例展示命令的具体用法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

###目的###
LINUX中,find结合grep正则表达式快速查找代码。

例如经常有需求:
查找当前目录下所有.h文件中,"public开头,中间任意字符,以VideoFrameReceiver结束" 的文件名。
find . -iname "*.h" -type f | xargs grep --color -n ".*public.*VideoFrameReceiver.*"

例如输出:
./components/mirroring/browser/single_client_video_capture_host.h:36: public media::VideoFrameReceiver {
./media/capture/video/mock_video_frame_receiver.h:13:class MockVideoFrameReceiver : public VideoFrameReceiver {
./media/capture/video/video_frame_receiver_on_task_runner.h:19: : public VideoFrameReceiver {
./services/video_capture/receiver_mojo_to_media_adapter.h:16:class ReceiverMojoToMediaAdapter : public media::VideoFrameReceiver {
./content/browser/renderer_host/media/video_capture_controller.h:40: : public media::VideoFrameReceiver,

###完毕###

转载于:https://www.cnblogs.com/huangguanyuan/p/9672325.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值