当前位置:网站首页>Detailed explanation of Ag search tool parameters
Detailed explanation of Ag search tool parameters
2022-07-25 21:17:00 【Tao Ge is still fly】
ag Detailed explanation of search tool parameters
Ag Is similar to ack, grep Tools for , It is used to search for the corresponding keywords in the file .
Officials have listed several reasons for choosing it :
- It is better than ack faster ( and grep Not on an order of magnitude )
- It will ignore .gitignore and .hgignore The matching file in
- If there are files you want to ignore , You need to add them to
.ignoreIn file - It has shorter command names :-)
install
ubuntu Direct installation :
sudo apt install silversearcher-ag
Basic use
ag The basic use of is very direct : Follow the command with what you want to search character string that will do , It will search all text files in the current directory , And return the result .
ag Module
Output :

You can see , The output will be clearly highlighted , and , It's really , Very fast .
.ignore The file name specified in the file will be skipped , No search . Just write in the file name you want to ignore :
# .ignore
model.py
trainer.py
Detailed format and command options
Here are some ag Common parameter options and their meanings :
| Options | function |
|---|---|
-s / -i / -S | Case sensitive / Insensitivity / Intelligent case determination ( Default ), That is, case sensitivity is turned on when there is uppercase , Otherwise it's not sensitive |
-c | count, Output several matching strings in each file |
-A / -B / -C [NUM] | after / before / context, Show matching to string [ after / front / Before and after ] NUM That's ok , Default 2 That's ok |
-a | Search all files , Include .ignore Ignored files , Don't include hidden files |
-D | Output ridiculous amounts of debugging info. Not useful unless you´re actually debugging. ( This sentence is the original manual , laugh ) |
-f | Track soft links , The default is not to track |
-g [PATTERN] | Output match PATTERN The name of the file |
-G [PATTERN] | Only search for file name matches PATTERN File contents of |
-l / -L | Only output can / The contents cannot match the file name of the successful file , Do not output line content |
-m [NUM] | Only before output NUM The content of the second successful match , Skip the rest , The default is 0, That is, all outputs |
-r / -n | yes / No, enter the directory for recursive search , Recursive search will be performed by default |
-o | Only the part of the line that matches successfully |
-p [PATH] | Provide the specified .ignore Path to file , Default to current directory |
-Q | Will not PATTERN Parse according to regular expressions |
-u | Search all files , Including binary files , But I still ignore .ignore Wait for the documents |
-U | Ignore VCS ignore file ( Include .gitignore, .hgignore), But I will still consider .ignore, The content of the first two will be searched , however .ignore The content in will still be ignored |
-w | Match only the whole word |
-V | Output version information |
-v | Match all lines that do not contain the specified string |
z | Search the contents of the compressed file |
Other options :
| Options | function |
|---|---|
--ackmate | By AckMate Output results in parsed format |
--hidden | Search for hidden files , But it will not search for ignored files , I.e -a contrary |
--depth [NUM] | Search directory depth ,-1 For unlimited , The default is 25 |
--ignore PATTERN | Ignore name matching to PATTERN Contents of files or directories , I.e -G contrary |
--[no]break | Whether there are blank lines between different files of search results , Default blank line |
--[no]color | Whether there is color highlight , The default is |
--column | Output column number |
This is basically all , There are also some parameters that are not very commonly used , All option parameters can man ag Check it out. .
边栏推荐
- 476-82(322、64、2、46、62、114)
- PayPal PHP product trial period "recommended collection"
- 接口测试工具 restlet client
- Differences between seaslog and monolog log systems, installation steps of seaslog [easy to understand]
- An interview question about recover in golang
- Leetcode-146: LRU cache
- Explain in detail the principle of MySQL master-slave replication "suggestions collection"
- Airtest解决“自动装包”过程中需要输入密码的问题(同适用于随机弹框处理)
- As a test, how to understand thread synchronization and asynchrony
- 牛客-TOP101-BM37
猜你喜欢

Basic knowledge of Marine Geology

DDD的Go实战

pyqt5使用pyqtgraph绘制多个Y值散点图

Remote - basic principle introduction

接口测试工具 restlet client

In depth understanding of seven specific ways to enhance code scalability

Cesium polygon gradient texture (canvas)

Success factors of software R & D effectiveness measurement

Programmer's Guide to health quenching 5: introduction to sports Basics

浅谈web性能优化(一)
随机推荐
Interface testing tool restlet client
Airtest solves the problem that a password needs to be entered in the process of "automatic packaging" (the same applies to random bullet frame processing)
day04_ array
SSH private key realizes login to remote target server
My heart's broken! After being cheated by 30000, a 16-year-old girl was unconvinced and cheated by 50000
[introduction to C language] zzulioj 1016-1020
Unity vs -- the default debugging in VS is to start rather than attach to unity debugging
Qixin Jushi cloud spectrum new chapter | Haitai Fangyuan and Sichuan Unicom reach ecological strategic cooperation
Oracle views the SQL statements with the slowest execution and the most queries
JMeter distributed pressure measurement
Pycharm跑程序时自动进入测试模式
Leetcode-919: complete binary tree inserter
Use Navicat to connect to MySQL database through SSH channel (pro test is feasible)
mysql导入数据时已改成csv utf8文件且文件名为英文,为什么还是导入失败
[FAQ] access the HMS core push service, and the server sends messages. Cause analysis and solutions of common error codes
Canvas fill gradient
作为测试,如何理解线程同步异步
How to store pictures in the database "suggested collection"
Leetcode skimming -- guess the size of numbers II 375 medium
牛客-TOP101-BM38