当前位置:网站首页>Grep exact match
Grep exact match
2022-06-29 13:46:00 【51CTO】
Use grep Five ways to achieve accurate filtering
(1) When the filtered content occupies a line
[[email protected] scripts]# cat oldboy.log
200
0200
2000
[[email protected] scripts]# grep "\b200\b" oldboy.log
200 #<== Regular match by word
[[email protected] scripts]# grep -w "200" oldboy.log
200 #<== Match by word
[[email protected] scripts]# grep -x "200" oldboy.log
200 #<== Match by entire row
[[email protected] scripts]# grep "^200$" oldboy.log
200 #<== Regular beginning and end match , It is equivalent to the whole line matching
[[email protected] scripts]# grep -E "\<200\>" oldboy.log
200 #<== Extended regularization
(2) When the filtered content occupies part of a line
[[email protected] scripts]# cat oldboy.log
200 oldboy
0200 oldgirl
2000 littleboy
[[email protected] scripts]# grep "\b200\b" oldboy.log
200 oldboy
[[email protected] scripts]# grep -w "200" oldboy.log
200 oldboy
[[email protected] scripts]# grep -x "200" oldboy.log
#<== Match by entire row , So there was no result
[[email protected] scripts]# grep -x "200 oldboy" oldboy.log
200 oldboy
[[email protected] scripts]# grep "^200$" oldboy.log
#<== Match by entire row , So there was no result
[[email protected] scripts]# grep "^200 oldboy$" oldboy.log
200 oldboy
[[email protected] scripts]# grep -E "\<200\>" oldboy.log
200 oldboy
边栏推荐
- 成功解决ValueError: Only TF native optimizers are supported in Eager mode
- Prometheus 2.28.0 new features
- iMile 利用 Zadig 多云环境周部署千次,跨云跨地域持续交付全球业务
- matplotlib的imshow函数显示灰度图像要设置vmin和vmax2个参数
- The former security director of Uber faced fraud allegations and concealed the data leakage event
- leetcode 903. Effective arrangement of Di sequences
- 开户可以在网上开么?能安全吗
- Windbg调试工具介绍
- @Table爆红
- Weserver Publishing Map Service
猜你喜欢

Cloud native (31) | kubernetes chapter kubernetes platform basic pre installed resources

云原生(三十一) | Kubernetes篇之Kubernetes平台基本预装资源

韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯

System. Currenttimemillis() and system Nanotime() which is faster? Most people get the wrong answer!

DeeCamp2022正式开营!李开复、张亚勤亲授大师课 | 创新事

weserver發布地圖服務

Rslo: self supervised lidar odometer (real time + high precision, icra2022)

WinDbg common commands

【云驻共创】通过Rust语言计算加速技术突破图片识别性能瓶颈
![[cloud resident co creation] break through the performance bottleneck of image recognition through rust language computing acceleration technology](/img/1a/c5e1e17d057c8b4ba2e57f28237498.png)
[cloud resident co creation] break through the performance bottleneck of image recognition through rust language computing acceleration technology
随机推荐
Rslo: self supervised lidar odometer (real time + high precision, icra2022)
【云驻共创】通过Rust语言计算加速技术突破图片识别性能瓶颈
成功解决ValueError: Only TF native optimizers are supported in Eager mode
grep 精确匹配
Imile uses Zadig's multi cloud environment to deploy thousands of times a week to continuously deliver global business across clouds and regions
win32版俄罗斯方块(学习MFC必不可少)
[untitled] error in installation dependency: refusing to install package with name "* * *" under a package
韩国AI团队抄袭震动学界!1个导师带51个学生,还是抄袭惯犯
高校女生穿旗袍答辩!网友:导师说论文要是和旗袍一样漂亮就好了
C language simulation to realize all character functions
MySQL tuning
Valueerror: only TF native optimizers are supported in Eagle mode
Basic type variable declaration
@Table爆红
Ordinary users use vscode to log in to SSH and edit the root file
Leetcode game 299
[system design] proximity service
C语言内存函数
Create an API rapid development platform, awesome!
*打卡算法*LeetCode 146. LRU 缓存 算法解析