当前位置:网站首页>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. .
边栏推荐
- Using the OAP aspect causes the controller to be called repeatedly
- ZigBee IOT development platform (Industrial IOT)
- Programmer's Guide to health quenching 5: introduction to sports Basics
- Leetcode-155: minimum stack
- cv图像翻转,EmguCV图像旋转「建议收藏」
- In depth understanding of seven specific ways to enhance code scalability
- Force deduction ----- calculate the money of the force deduction bank
- CTS test steps (Casio cts200 test)
- SSH private key realizes login to remote target server
- MPI学习笔记(二):矩阵相乘的两种实现方法
猜你喜欢

When facing complex problems, systematic thinking helps you understand the essence of the problem

Sum of two numbers and three numbers

Canvas fill gradient

Opencv learning Fourier transform experience and line direction Fourier transform code

Pycharm跑程序时自动进入测试模式

LeetCode刷题——猜数字大小II#375#Medium

IEC61131 address representation

腾讯云数据库的可信可控之路

Canvas 填充渐变
![[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track](/img/ef/33f93225171e2c3e14b7d090c68196.png)
[depth] the new LAAS agreement elephant: the key to revitalizing the development of the defi track
随机推荐
字节一面:TCP 和 UDP 可以使用同一个端口吗?
yuv422转rgb(422sp转420p)
Leetcode-6130: designing digital container systems
GDB locates the main address of the program after strip
ag 搜索工具参数详解
Explain in detail the principle of MySQL master-slave replication "suggestions collection"
作为测试,如何理解线程同步异步
How to automatically generate short chains? How to generate links with UTM parameters online in batches?
Test cases and defect report templates
cuda_ error_ out_ of_ Memory (out of memory)
Matlab---eeglab check EEG signal
Blood spitting finishing nanny level series tutorial - playing Fiddler bag capturing tutorial (7) - Fiddler status panel -quickexec command line
An interview question about interface and implementation in golang
Kali modify the update source (it is not safe to update with this source)
3阶有向完全图的所有非同构的子图(不同钩子图个数)
Trusted and controllable way of Tencent cloud database
Autojs learning - Automatic screenshot of the king
Miscellaneous notes -- a hodgepodge
【C语言入门】ZZULIOJ 1016-1020
Isn't it too much to play Gobang in idea?