当前位置:网站首页>Grep of three swordsmen in text processing
Grep of three swordsmen in text processing
2022-07-07 12:57:00 【LC181119】
grep:Global search REgular expression and Print out the line
effect : Text search tools , According to the user specified “ Pattern ” Match the target text line by line ; Print the matched lines
Pattern : Filter conditions written by regular expression characters and text characters
Format :
grep [OPTIONS] PATTERN [FILE...]Common options :
- -color=auto Color the matched text
- -m # matching # Stop after
- -V Display not pattern Matched rows , Take the opposite
- -i Ignore character case
- -n Display the matched line number
- -c Count the number of rows matched
- -o Show only strings that match
- -q silent mode , Do not output any information
- -A # after, after # That's ok
- -B # before, front # That's ok
- -C # context, Before and after # That's ok
- -e Implement logic between multiple options or Relationship , Such as grep -e ‘cat’ -e ‘dog’ file
- -w Match the whole word
- -E Use ERE, amount to egrep
- -F Regular expressions are not supported , amount to fgrep
- -f file Process according to the schema file
- -r Recursive directory , But don't handle soft links
- -R Recursive directory , But dealing with soft links
Example : Take the same line of two files
[19:33:09 [email protected] data]#cat f1.txt
a
b
1
c
[19:33:24 [email protected] data]#cat f2.txt
b
e
f
c
1
2
[19:33:28 [email protected] data]#grep -f f1.txt f2.txt
b
c
边栏推荐
- 数据库安全的重要性
- 明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
- [statistical learning method] learning notes - support vector machine (I)
- [learn microservices from 0] [03] explore the microservice architecture
- Realize a simple version of array by yourself from
- ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
- xshell评估期已过怎么办
- leetcode刷题:二叉树26(二叉搜索树中的插入操作)
- visual stdio 2017关于opencv4.1的环境配置
- 2022危险化学品生产单位安全生产管理人员考题及在线模拟考试
猜你喜欢

About IPSec

达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑

- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net

ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集

Leetcode brush question: binary tree 24 (the nearest common ancestor of binary tree)

聊聊Redis缓存4种集群方案、及优缺点对比

Polymorphism, final, etc

Leetcode brush questions: binary tree 19 (merge binary tree)

Go语言学习笔记-结构体(Struct)
![《ASP.NET Core 6框架揭秘》样章[200页/5章]](/img/4f/5688c391dd19129d912a3557732047.jpg)
《ASP.NET Core 6框架揭秘》样章[200页/5章]
随机推荐
visual stdio 2017关于opencv4.1的环境配置
[binary tree] delete points to form a forest
Day-16 set
Find ID value MySQL in string
Several ways to clear floating
[Q&A]AttributeError: module ‘signal‘ has no attribute ‘SIGALRM‘
明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
关于 appium 启动 app 后闪退的问题 - (已解决)
[statistical learning methods] learning notes - Chapter 4: naive Bayesian method
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
Enterprise custom form engine solution (XII) -- experience code directory structure
Session
在字符串中查找id值MySQL
NPM instal reports agent or network problems
Session
用mysql查询某字段是否有索引
Unity 构建错误:当前上下文中不存在名称“EditorUtility”
About IPSec
Charles: four ways to modify the input parameters or return results of the interface