当前位置:网站首页>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
边栏推荐
- The URL modes supported by ThinkPHP include four common modes, pathinfo, rewrite and compatibility modes
- What if the xshell evaluation period has expired
- Adopt a cow to sprint A shares: it plans to raise 1.85 billion yuan, and Xu Xiaobo holds nearly 40%
- Enterprise custom form engine solution (XII) -- experience code directory structure
- Common knowledge of one-dimensional array and two-dimensional array
- 怎样重置火狐浏览器
- HZOJ #240. 图形打印四
- HZOJ #236. 递归实现组合型枚举
- 环境配置篇
- [statistical learning method] learning notes - support vector machine (I)
猜你喜欢
[statistical learning method] learning notes - support vector machine (Part 2)
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
Visual stdio 2017 about the environment configuration of opencv4.1
Leetcode skimming: binary tree 20 (search in binary search tree)
Day-18 hash table, generic
opencv的四个函数
leetcode刷题:二叉树20(二叉搜索树中的搜索)
[statistical learning method] learning notes - support vector machine (I)
Day-19 IO stream
随机推荐
详解ThinkPHP支持的URL模式有四种普通模式、PATHINFO、REWRITE和兼容模式
leetcode刷题:二叉树26(二叉搜索树中的插入操作)
Sorting, dichotomy
Leetcode skimming: binary tree 20 (search in binary search tree)
免费手机号码归属地API查询接口
Design and implementation of communication protocol
【无标题】
Cmu15445 (fall 2019) project 2 - hash table details
MySQL importing SQL files and common commands
2022 polymerization process test question simulation test question bank and online simulation test
明星企业普渡科技大裁员:曾募资超10亿 腾讯红杉是股东
[learn wechat from 0] [00] Course Overview
SSM框架搭建的步骤
HZOJ #235. Recursive implementation of exponential enumeration
【二叉树】删点成林
Day21 multithreading
- Oui. Migration entièrement automatisée de la Sous - base de données des tableaux d'effets sous net
HZOJ #236. 递归实现组合型枚举
Blog recommendation | Apache pulsar cross regional replication scheme selection practice
MySQL导入SQL文件及常用命令