当前位置:网站首页>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
边栏推荐
猜你喜欢
Leetcode skimming: binary tree 22 (minimum absolute difference of binary search tree)
Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
基于NeRF的三维内容生成
Leetcode skimming: binary tree 23 (mode in binary search tree)
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
2022 practice questions and mock examination of the third batch of Guangdong Provincial Safety Officer a certificate (main person in charge)
2022 examination questions and online simulation examination for safety production management personnel of hazardous chemical production units
[statistical learning method] learning notes - support vector machine (I)
关于 appium 如何关闭 app (已解决)
leetcode刷题:二叉树24(二叉树的最近公共祖先)
随机推荐
What are the benefits of ip2long?
测试下摘要
Realize a simple version of array by yourself from
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
2022a special equipment related management (boiler, pressure vessel and pressure pipeline) simulated examination question bank simulated examination platform operation
Session
ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
《ASP.NET Core 6框架揭秘》样章[200页/5章]
在字符串中查找id值MySQL
leetcode刷题:二叉树21(验证二叉搜索树)
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
About IPSec
[statistical learning method] learning notes - logistic regression and maximum entropy model
[binary tree] delete points to form a forest
Query whether a field has an index with MySQL
Image pixel read / write operation
用mysql查询某字段是否有索引
明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind