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

###目的###
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,

###完毕###

上一篇:简述spring的工作原理


下一篇:SharePoint 2010、2013多个域之间互信(Domain Trust)的设计与实施