ag

Expand command line exclude pattern with zsh

喜夏-厌秋 提交于 2019-12-24 09:40:12
问题 I'm trying to pass a complicated regex as an ignore pattern. I want to ignore all subfolders of locales/ except locales/US/en/* . I may need to fallback to using a .agignore file, but I'm trying to avoid that. I'm using silver searcher (similar to Ack, Grep). I use zsh in my terminal. This works really well and ignores all locale subfolders except locales/US : ag -g "" --ignore locales/^US/ | fzf I also want to ignore all locales/US/* except for locales/US/en Want I want is this, but it does

ag: Search all folders except for folderName/subFolder (Perl Regex)

送分小仙女□ 提交于 2019-12-04 06:11:56
问题 I have these folders that have subfolders in them... locales/US/en locales/US/fr locales/FR/en locales/FR/fr locales/DE/en locales/DE/fr public test [...] I want Silver Searcher to ignore locales/* EXCEPT for locales/US/en/* (essentially I only care about US/en locale files) This works, EXCEPT that it doesn't show the other folders in root (public and test): ag -l -G '(locales)/(US)' I believe AG uses Perl Regexes. Any thoughts? 回答1: If it is perl regular expressions this should give you the

ag: Search all folders except for folderName/subFolder (Perl Regex)

 ̄綄美尐妖づ 提交于 2019-12-02 09:26:45
I have these folders that have subfolders in them... locales/US/en locales/US/fr locales/FR/en locales/FR/fr locales/DE/en locales/DE/fr public test [...] I want Silver Searcher to ignore locales/* EXCEPT for locales/US/en/* (essentially I only care about US/en locale files) This works, EXCEPT that it doesn't show the other folders in root (public and test): ag -l -G '(locales)/(US)' I believe AG uses Perl Regexes. Any thoughts? If it is perl regular expressions this should give you the expected result: ^(?:locales/US/en|(?!locales)) Explanation: ^ = anchor regular expression to start of

Searching multiple patterns (words) with ack?

随声附和 提交于 2019-11-30 15:24:17
问题 I want to search multiple patterns in a directory containing recursive directories and files . I know command for grep which is as follows grep -e '(pattern1)|(pattern2)' or grep -r -E 'string1|string2|string3' /var/www/http What is the command for that using ack or ag ? 回答1: This should be enough: ack -R 'string1|string2' As -R is the default, you can omit it: ack 'string1|string2' From man ack : -r , -R , --recurse Recurse into sub-directories. This is the default and just here for

Searching multiple patterns (words) with ack?

删除回忆录丶 提交于 2019-11-30 13:28:19
I want to search multiple patterns in a directory containing recursive directories and files . I know command for grep which is as follows grep -e '(pattern1)|(pattern2)' or grep -r -E 'string1|string2|string3' /var/www/http What is the command for that using ack or ag ? This should be enough: ack -R 'string1|string2' As -R is the default, you can omit it: ack 'string1|string2' From man ack : -r , -R , --recurse Recurse into sub-directories. This is the default and just here for compatibility with grep. You can also use it for turning --no-recurse off. If you want to get the pattern from a