查找返回字符串行号的命令 [英] Find Command that returns line number of the string

查看:100
本文介绍了查找返回字符串行号的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆文件整理成目录.所有这些都是文本文件(c/c ++).我试图理解此代码,我需要查看许多变量的声明.如何在ubuntu linux中使用find命令在find命令中使用find命令获取确切位置(带有行号的文件名)?还是有任何图形工具可以做到这一点?

I have a bunch of files organized into directories..All these are text files (c/c++). I am trying to understand this code and i need to look at the declarations of many variables..How can i use find command to get the exact location( File Name with line number(s) ) using Find command in ubuntu linux?? Or is there any graphical tool for doing the same?

推荐答案

您可以使用grep进行此操作. grep -n 'search-term' *.c将为您提供该术语出现的文件名和行号.

You can do this with grep. grep -n 'search-term' *.c will give you the filename and line number where the term appears.

这篇关于查找返回字符串行号的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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