当前位置:网站首页>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
边栏推荐
- 2022聚合工艺考试题模拟考试题库及在线模拟考试
- Realize a simple version of array by yourself from
- HZOJ #240. Graphic printing IV
- Day-24 UDP, regular expression
- 数据库安全的重要性
- Sequoia China completed the new phase of $9billion fund raising
- mysql怎么创建,删除,查看索引?
- 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
- PHP调用纯真IP数据库返回具体地址
- Enterprise custom form engine solution (XII) -- experience code directory structure
猜你喜欢
Go语言学习笔记-结构体(Struct)
Day-16 set
2022聚合工艺考试题模拟考试题库及在线模拟考试
Sequoia China completed the new phase of $9billion fund raising
Leetcode question brushing: binary tree 26 (insertion operation in binary search tree)
Day-15 common APIs and exception mechanisms
Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
红杉中国完成新一期90亿美元基金募集
leetcode刷题:二叉树21(验证二叉搜索树)
Leetcode skimming: binary tree 21 (verifying binary search tree)
随机推荐
Aike AI frontier promotion (7.7)
红杉中国完成新一期90亿美元基金募集
Leetcode skimming: binary tree 23 (mode in binary search tree)
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
Visual stdio 2017 about the environment configuration of opencv4.1
Day-18 hash table, generic
免费手机号码归属地API查询接口
leetcode刷题:二叉树24(二叉树的最近公共祖先)
[pytorch practice] write poetry with RNN
Four functions of opencv
Polymorphism, final, etc
[Q&A]AttributeError: module ‘signal‘ has no attribute ‘SIGALRM‘
Day-24 UDP, regular expression
【从 0 开始学微服务】【00】课程概述
关于 appium 如何关闭 app (已解决)
Cookie
leetcode刷题:二叉树22(二叉搜索树的最小绝对差)
What kind of methods or functions can you view the laravel version of a project?
2022 polymerization process test question simulation test question bank and online simulation test
ip2long之后有什么好处?