grep经常使用使用方法
grep简单介绍
正如linux的man文件里所描写叙述的那样:
grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a match to the given PATTERN. By default, grep prints the matching lines.
In addition, two variant programs egrep and fgrep are available. egrep is the same as grep -E. fgrep is the same as grep -F. Direct invocation as either egrep or fgrep is deprecated, but is provided to allow historical applications that rely on them to run unmodified.
grep是用来在一个文件里查找和给定的模式相匹配的行的命令,同一时候egrep 和 fgrep都已经被弃用。取而代之的是 grep -E和grep -F。
用法
在单个文件里搜索包括字符串的行
语法:
grep “literal_string” filename
在多个文件里搜索包括字符串的行
语法:
grep “this” demo_*
注:这个的搜索域是demo_为前缀的文件
使用 -i 參数能够实现大写和小写无关
能够使用正則表達式来过滤
语法:
grep “REGEX” filename
详细用法能够參考:http://www.cnblogs.com/kuyuecs/archive/2012/07/13/2589988.html
写得非常不错的博客。
$(function () {
$('pre.prettyprint code').each(function () {
var lines = $(this).text().split('\n').length;
var $numbering = $('
$(this).addClass('has-numbering').parent().append($numbering);
for (i = 1; i ').text(i));
};
$numbering.fadeIn(1700);
});
});
grep经常使用使用方法的更多相关文章
- Grep查看日志的方法【转】
转自:http://blog.csdn.net/stormkey/article/details/5905204 版权声明 :转载时请以超链接形式标明文章原始出处和作者信息及本声明 http://go ...
- shell使用ps -ef|grep xxx时不显示grep xxx进程的方法
在使用ps -ef|grep xxx时会将grep xxx的进程也带出来, 而在脚本中如果想要截取此命令结果的一部分,则grep xxx的进程会显得多余,如下: [root@localhost ~]# ...
- Jquery 遍历数组之grep()方法介绍
grep()方法用于数组元素过滤筛选. grep(array,callback,boolean);方法参数介绍. array ---待处理数组 callback ---这个回调函数用来处理数组中 ...
- Linux 查找已安装软件的方法
1.rpm 注意rpm区分大小写 查询已安装的以mysql开头的包 rpm -qa mysql* 查询已安装的mysql 包 rpm -qa|grep mysql rpm的方法有时候也所有已安装的包 ...
- grep使用
grep常用的使用方法 grep –rns “match_content”filename 查看匹配内容的行 find /path –name “*.h” –o –name “*.cpp” | xar ...
- 聊一聊ES5数组(Array)新增的那些方法
一.前言 ES5中新增的一些处理数组(Array)的方法, 对于用JavaScript处理数据非常有用.我总结了一下,给这些方法分了类,大体如下: 2个索引方法:indexOf() 和 lastInd ...
- shell脚本中 杀死可能成为僵尸进程的方法
交互式 Bash Shell 获取进程 pid 在已知进程名(name)的前提下,交互式 Shell 获取进程 pid 有很多种方法,典型的通过 grep 获取 pid 的方法为(这里添加 -v gr ...
- linux批量替换文件内容3种方法(perl,sed,shell)
方法1:perl 这两天在构建一个应用的使用用到了maven,由于project很大,足足有700多个 pom.xml文件,更郁闷的是在很多pom.xml文件里都单独指定了资源库的url,我需要把 ...
- linux杀死进程方法
方法一: 根据pid ps -aux|grep 你的进程 方法二: 删除pid文件 [root@localhost ~]# /etc/init.d/redis_6380 start /var/run/ ...
随机推荐
- erase() 返回的是删除此元素之后的下一个元素的迭代器 .xml
pre{ line-height:1; color:#f0caa6; background-color:#2d161d; font-size:16px;}.sysFunc{color:#e54ae9; ...
- cocos2d-x 全面总结--字体描边和制作阴影
关于字体描边的实现,不考虑效果和效率的话,是有三种方式: ① 利用CCLabelTTF制作文字描边和阴影效果 ② 利用CCRenderTexture渲染文理的方式生成带有描边效果的文字 ③ 利用sha ...
- strtok和strtok_r
1.strtok()函数的用法 函数原型:char *strtok(char *s, const char *delim); Function:分解字符串为一组字符串.s为要分解的字符串,delim为 ...
- 字符串和数组中split().toString(),join(),splice(),slice(),substr()和substring()
<!Doctype html> <head> <mate charset="utf-8"> <title>string change ...
- IE对toLocaleString小数位处理
在js中对数值的格式化经常会用到四舍五入.保留小数位数.百分制格式化,分别会用到以下方法 <script type="text/javascript"> var n = ...
- Srum框架
Srum包括三个角色.四个会议.及三个产出物,如下图所示:
- Tcl之load
做一个ASIC项目,基本结构是MCU+ROM+RAM.目前想把单片机程序下载到ROM中,然后在ModelSim中仿真程序,得到运行结果.好二哥给出的Tcl下载文件如下,细细研读中... puts &q ...
- [cocos2d-js]chipmunk例子(二)
; ; ; ; <<; var NOT_GRABABLE_MASK = ~GRABABLE_MASK_BIT; var MainLayer = cc.Layer.extend({ _bal ...
- Leetcode237:Delete Node in a Linked List
Write a function to delete a node (except the tail) in a singly linked list, given only access to th ...
- XML文件的生成与读取
从数据库生成: public static void ToXML(string tablename) { //获取数据 string sql = "select * from " ...