Wednesday, January 30, 2013

GREP command : How to use ??

GREP: Three version of grep command in UNIX 'grep, fgrep, egrep'. 'fgrep' stands for Fixed 'grep'. 'egrep' Extended 'grep'. 1. To find relevant word and exclusion irrelevant word. # grep Exception logfile.txt | grep -v ERROR 2.If you want to count of a particular word in log file you can use grep -c option to count the word. # grep -c "Error" logfile.txt 3. grep --context option allows us to print lines around matching pattern....
Read more ...

grep命令基础练习题

常用的grep选项是: -c 只输出匹配行的计数。 -i 不区分大小写(只适用于单字符)。 -h 查询多文件时不显示文件名。 -l 查询多文件时只输出包含匹配字符的文件名。 -n 显示匹配行及行号。 -s 不显示不存在或无匹配文本的错误信息。 -v 显示不包含匹配文本的所有行。 文件格式: 第1列:城市位置编号。 第2列:月份。 第3列:存储代码及出库年份。 第4列:产品代号。 第5列:产品统一标价。 第6列:标识号。 第7列:合格数量。 file.txt文件内容: 48      Dec     3BC1977 LPSX   68.00   LVX2A   138 483     Sept    5AP1996 USP    65.00   LVX2C   189 47  ...
Read more ...