当前位置:网站首页>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
边栏推荐
- HZOJ #235. 递归实现指数型枚举
- Cookie
- 【无标题】
- ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
- 认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
- How to apply @transactional transaction annotation to perfection?
- What are the benefits of ip2long?
- 2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
- leetcode刷题:二叉树24(二叉树的最近公共祖先)
- PHP calls the pure IP database to return the specific address
猜你喜欢

Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders

leetcode刷题:二叉树26(二叉搜索树中的插入操作)

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

Cookie

Importance of database security

visual stdio 2017关于opencv4.1的环境配置

Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]

Session

Leetcode skimming: binary tree 21 (verifying binary search tree)

2022聚合工艺考试题模拟考试题库及在线模拟考试
随机推荐
Enterprise custom form engine solution (XII) -- experience code directory structure
达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑
Simple implementation of call, bind and apply
Cookie
MySQL导入SQL文件及常用命令
[pytorch practice] write poetry with RNN
Day-24 UDP, regular expression
Cmu15445 (fall 2019) project 2 - hash table details
What if the xshell evaluation period has expired
[statistical learning methods] learning notes - Chapter 4: naive Bayesian method
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
Unity 构建错误:当前上下文中不存在名称“EditorUtility”
基于NeRF的三维内容生成
HZOJ #240. Graphic printing IV
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
Day-15 common APIs and exception mechanisms
怎样重置火狐浏览器
Query whether a field has an index with MySQL
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
处理链中断后如何继续/子链出错removed from scheduling