grep 匹配的几个参数

本文介绍了grep命令的-o,-F,-E参数的使用。-o用于只输出匹配的部分,-F用于将模式视为固定字符串而非正则表达式,-E则支持扩展正则表达式。通过示例解释了这些参数如何帮助过滤和查找特定信息。" 118682078,5667377,使用Photos框架处理相册资源:筛选、GIF与LivePhoto处理,"['ios', 'Photos', 'PhotoKit', '相册资源', 'GIF']
摘要由CSDN通过智能技术生成

grep -o

grep 忽略匹配自己 ps aux | grep python 总是会看到一个包含grep的匹配项,这是不符合我们的匹配期望的。可以这样过滤掉grep这个匹配项。可以用下面这个命令来实现

ps aux | grep python | grep -v grep

grep -F

grep -F 等价于 fgrep。 egrep 等价于 grep -E。
下面是找到的资料

You have a file with a list of say ten Unix usernames in plain text. You want to search the group file on your machine to see if any of the ten users listed are in any special groups:

grep -F -f user_list.txt /etc/group

The reason the -F switch helps here is that the usernames in your pattern file are interpreted as plain text strings. Dots for example would be interpreted as dots rather than wild-cards. -f 表示内容从 user_list.txt 中读取。

grep -o

grep -o 输出匹配的内容。

grep -E

支持扩展的正则表达式。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值