定义根据用户指定的pattern过滤目标文件,显示被忽略的行格式:grep[parameter]matchingcontent[file]常用参数:-v:显示不匹配的行-i:忽略大小写-n:显示匹配的行号-c:统计匹配的行数-o:只显示匹配的字符串-E:使用ERE,相当于egrep的实际应用:显示包含root的行,并显示行号$cattestrootroothellorootnewrootrootleokatehogwartstringleon$grep-nroottest1:rootroothelloroot4:root5:root显示不包含root的行,并显示行号$grep-vnroottest2:new3:new6:leo7:kate8:hogwart9:string10:leon查找以s开头的行;查找以n$结尾的行grep^s-ntest9:string$grepn$-ntest10:leon
