当前位置:网站首页>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 27 (delete nodes in the binary search tree)
- Cmu15445 (fall 2019) project 2 - hash table details
- AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
- Master公式。(用于计算递归的时间复杂度。)
- [crawler] avoid script detection when using selenium
- Unity 构建错误:当前上下文中不存在名称“EditorUtility”
- ACL 2022 | 序列标注的小样本NER:融合标签语义的双塔BERT模型
- Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
- leetcode刷题:二叉树25(二叉搜索树的最近公共祖先)
- 详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
猜你喜欢

如何将 @Transactional 事务注解运用到炉火纯青?

Sequoia China completed the new phase of $9billion fund raising

leetcode刷题:二叉树23(二叉搜索树中的众数)

.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics

leetcode刷题:二叉树24(二叉树的最近公共祖先)

Day-18 hash table, generic

Day-16 set

数据库安全的重要性

Day-14 common APIs
随机推荐
[learn wechat from 0] [00] Course Overview
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
Day-18 hash table, generic
What kind of methods or functions can you view the laravel version of a project?
明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
[learn micro services from 0] [02] move from single application to service
HZOJ #236. Recursive implementation of combinatorial enumeration
Session
认养一头牛冲刺A股:拟募资18.5亿 徐晓波持股近40%
HZOJ #235. Recursive implementation of exponential enumeration
Smart cloud health listed: with a market value of HK $15billion, SIG Jingwei and Jingxin fund are shareholders
[statistical learning methods] learning notes - Chapter 4: naive Bayesian method
AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
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
Simple implementation of call, bind and apply
ip2long之后有什么好处?
Steps of building SSM framework
layer弹出层的关闭问题
[binary tree] delete points to form a forest
用mysql查询某字段是否有索引