ag命令详解

来源:互联网 发布:青年网络公开课有几集 编辑:程序博客网 时间:2024/04/27 21:42

root@hadoop1 opt]$ ag "s"

1.log

5:s

7:s

9:sss

 

2.log

1:sdsfefe

root@hadoop1 opt]$  ag "s" 1.log 

5:s

7:s

9:sss



$ ag -l --java "JDBC Multitable Consumer"





$ ag --help



Usage: ag [FILE-TYPE] [OPTIONS] PATTERN [PATH]


  Recursively search for PATTERN in PATH.
  Like grep or ack, but faster.


Example:
  ag -i foo /bar/


Output Options:
     --ackmate            Print results in AckMate-parseable format
  -A --after [LINES]      Print lines after match (Default: 2)
  -B --before [LINES]     Print lines before match (Default: 2)
     --[no]break          Print newlines between matches in different files
                          (Enabled by default)
  -c --count              Only print the number of matches in each file.
                          (This often differs from the number of matching lines)
     --[no]color          Print color codes in results (Enabled by default)
     --color-line-number  Color codes for line numbers (Default: 1;33)
     --color-match        Color codes for result match numbers (Default: 30;43)
     --color-path         Color codes for path names (Default: 1;32)
     --column             Print column numbers in results
     --[no]filename       Print file names (Enabled unless searching a single file)
  -H --[no]heading        Print file names before each file's matches
                          (Enabled by default)
  -C --context [LINES]    Print lines before and after matches (Default: 2)
     --[no]group          Same as --[no]break --[no]heading
  -g PATTERN              Print filenames matching PATTERN
  -l --files-with-matches Only print filenames that contain matches
                          (don't print the matching lines)
  -L --files-without-matches
                          Only print filenames that don't contain matches
     --[no]numbers        Print line numbers. Default is to omit line numbers
                          when searching streams
  -o --only-matching      Prints only the matching part of the lines
     --print-long-lines   Print matches on very long lines (Default: >2k characters)
     --passthrough        When searching a stream, print all lines even if they
                          don't match
     --silent             Suppress all log messages, including errors
     --stats              Print stats (files scanned, time taken, etc.)
     --stats-only         Print stats and nothing else.
                          (Same as --count when searching a single file)
     --vimgrep            Print results like vim's :vimgrep /pattern/g would
                          (it reports every match on the line)
  -0 --null --print0      Separate filenames with null (for 'xargs -0')


Search Options:
  -a --all-types          Search all files (doesn't include hidden files
                          or patterns from ignore files)
  -D --debug              Ridiculous debugging (probably not useful)
     --depth NUM          Search up to NUM directories deep (Default: 25)
  -f --follow             Follow symlinks
  -F --fixed-strings      Alias for --literal for compatibility with grep
  -G --file-search-regex  PATTERN Limit search to filenames matching PATTERN
     --hidden             Search hidden files (obeys .*ignore files)
  -i --ignore-case        Match case insensitively
     --ignore PATTERN     Ignore files/directories matching PATTERN
                          (literal file/directory names also allowed)
     --ignore-dir NAME    Alias for --ignore for compatibility with ack.
  -m --max-count NUM      Skip the rest of a file after NUM matches (Default: 10,000)
     --one-device         Don't follow links to other devices.
  -p --path-to-ignore STRING
                          Use .ignore file at STRING
  -Q --literal            Don't parse PATTERN as a regular expression
  -s --case-sensitive     Match case sensitively
  -S --smart-case         Match case insensitively unless PATTERN contains
                          uppercase characters (Enabled by default)
     --search-binary      Search binary files for matches
  -t --all-text           Search all text files (doesn't include hidden files)
  -u --unrestricted       Search all files (ignore .ignore, .gitignore, etc.;
                          searches binary and hidden files as well)
  -U --skip-vcs-ignores   Ignore VCS ignore files
                          (.gitignore, .hgignore; still obey .ignore)
  -v --invert-match
  -w --word-regexp        Only match whole words
  -W --width NUM          Truncate match lines after NUM characters
  -z --search-zip         Search contents of compressed (e.g., gzip) files


File Types:
The search can be restricted to certain types of files. Example:
  ag --html needle
  - Searches for 'needle' in files with suffix .htm, .html, .shtml or .xhtml.


For a list of supported file types run:
  ag --list-file-types


ag was originally created by Geoff Greer. More information (and the latest release)
can be found at http://geoff.greer.fm/ag
阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 交通事故扣车要收费吗 菏泽公交车事故3人死亡 交通事故扣车放车条件 未修复事故车出售群 迈腾事故车 二手事故车出售信息 两车左转弯事故责任划分图解 腾信事故车 山东事故车拍卖网 保险公司事故车拍卖 买到事故车怎么办 丰顺路宝事故车拍卖网 88事故车 88网事故车拍卖网 德信行事故车拍卖 事故车手续 事故车拍卖网站大全 残值车交易网 平安保险事故车拍卖网 腾信事故车交易网 88事故车交易网 水淹事故车出售信息 事故车88网手机版 保险公司事故车拍卖网 肇事车 事故车88 保险公司事故车出售点 事故车能卖多少钱 收事故车 事故车查询 事故车网站 买了事故车怎么办 交通事故车 事故车如何鉴定 怎么查事故车 事故车群 事故车理赔流程 事故车汽配商 事故车拍卖平台 事故车怎么查 事故车7车网