grep's Options

本文详细介绍了grep命令的各种选项及其用途,包括忽略大小写、显示匹配行数等实用功能。适用于需要掌握grep命令高级用法的技术人员。
Table 4.2. grep's Options

Option

What It Does

–b

Precedes each line by the block number on which it was found. This is sometimes useful in locating disk block numbers by context.

–c

Displays a count of matching lines rather than displaying the lines that match.

–h

Does not display filenames.

–i

Ignores the case of letters in comparisons (i.e., upper- and lowercase are considered identical).

–l

Lists only the names of files with matching lines (once), separated by newline characters.

–n

Precedes each line by its relative line number in the file.

–s

Works silently, that is, displays nothing except error messages. This is useful for checking the exit status.

–v

Inverts the search to display only lines that do not match.

–w

Searches for the expression as a word, as if surrounded by \< and \>. This applies to grep only. (Not all versions of grep support this feature; e.g., SCO UNIX does not.)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值