ack

Unfamiliar shell syntax in ack-grep install script

匆匆过客 提交于 2019-12-07 06:13:41
问题 From the ack installation page (http://betterthangrep.com/install/) there is a one-liner installation with curl: curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3 I understand that it's getting the file from the website and saving it to ~/bin/ack, then setting permissions, but what does that last part ( !#:3 ) do ? (I do not recognize the syntax and Googling didn't yield any helpful results) 回答1: See the section called HISTORY EXPANSION in man bash, particularly the

Ack & negative lookahead giving errors

梦想与她 提交于 2019-12-06 22:12:38
问题 I have a problem with using ack-grep with a negative look ahead. I am running this command: ack-grep "paypal_responded(?!_at)" but I am getting the error: bash: !_at: event not found I have tried adding backslashes in various places, but I'm also new to using ack & linux, so please treat me as a newbie with any instructions. Thanks in advance. 回答1: Try ack-grep 'paypal_responded(?!_at)' You need single-quote to avoid bash interpret ! as history expand command. 回答2: The shell is interpreting

How can I get ack to ignore *.orig files?

时光毁灭记忆、已成空白 提交于 2019-12-06 16:32:17
问题 I put this in my .ackrc: --type-set=DUMB=*.orig --noDUMB ... but I'm still seeing files like main.py.orig in my ack results. I tried doing --type-set=DUMB=*.*.orig too, but that didn't work either. More info Run from my command line (OSX Snow Leopard with : timmfin at lorien in ~/dev/performable/rafa on landing-pages-csv-and-more! ± ack modules --python | grep '.orig' src/rafa/main.py.orig:25:import rafa.ui.modules.helpers src/rafa/main.py.orig:26:from rafa.ui.modules.performable_form import

grep: repetition-operator operand invalid

风格不统一 提交于 2019-12-05 16:57:37
问题 I have this regular express (?<=heads\/)(.*?)(?=\n) and you can see it working here http://regexr.com?347dm I need this regex to work in the grep command but I'm getting this error. $ grep -Eio '(?<=heads\/)(.*?)(?=\n)' text.txt grep: repetition-operator operand invalid It works great in ack but I dont have ack on the machine I need to run this on. ack text.txt -o --match '(?<=heads\/)(.*?)(?=\n)' text.txt 74f3649af36984e1b784e46502fe318e91d29570 HEAD 06d4463ab47a6246e6bd94dc3b9267d59fc16c2e

ack - Binding an actual file name to a filetype

十年热恋 提交于 2019-12-05 12:57:25
For me ack is essential kit (its aliased to a and I use it a million times a day). Mostly it has everything I need so I'm figuring that this behavior is covered and I just can't find it. I'd love to be able to restrict it to specific kinds of files using a type. the problem is that these files have a full filename rather than an extension. For instance I'd like to restrict it to build files for buildr so i can search them with --buildr (Similar would apply for mvn poms). I have the following defined in my .ackrc --type-set=buildr=buildfile,.rake The problem is that 'buildfile' is the entire

Unfamiliar shell syntax in ack-grep install script

你说的曾经没有我的故事 提交于 2019-12-05 09:27:07
From the ack installation page (http://betterthangrep.com/install/) there is a one-liner installation with curl: curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3 I understand that it's getting the file from the website and saving it to ~/bin/ack, then setting permissions, but what does that last part ( !#:3 ) do ? (I do not recognize the syntax and Googling didn't yield any helpful results) See the section called HISTORY EXPANSION in man bash, particularly the Word Designators subsection. !#:3 refers to the third word of the pipe, which is (in your example) ~/bin

Ack & negative lookahead giving errors

非 Y 不嫁゛ 提交于 2019-12-05 01:29:13
I have a problem with using ack-grep with a negative look ahead. I am running this command: ack-grep "paypal_responded(?!_at)" but I am getting the error: bash: !_at: event not found I have tried adding backslashes in various places, but I'm also new to using ack & linux, so please treat me as a newbie with any instructions. Thanks in advance. Try ack-grep 'paypal_responded(?!_at)' You need single-quote to avoid bash interpret ! as history expand command. The shell is interpreting the ! in your input as a command substitution: $ ack-grep root /etc/passwd root:x:0:0:root:/root:/bin/bash $ !ac

How can I get ack to ignore *.orig files?

房东的猫 提交于 2019-12-04 22:14:01
I put this in my .ackrc: --type-set=DUMB=*.orig --noDUMB ... but I'm still seeing files like main.py.orig in my ack results. I tried doing --type-set=DUMB=*.*.orig too, but that didn't work either. More info Run from my command line (OSX Snow Leopard with : timmfin at lorien in ~/dev/performable/rafa on landing-pages-csv-and-more! ± ack modules --python | grep '.orig' src/rafa/main.py.orig:25:import rafa.ui.modules.helpers src/rafa/main.py.orig:26:from rafa.ui.modules.performable_form import PerformableForm src/rafa/main.py.orig:27:from rafa.ui.modules.page_form import PageEditForm src/rafa

ack: Excluding only one directory but keeping all others with the same name

时间秒杀一切 提交于 2019-12-04 14:56:52
问题 My folder structure looks like this: /app /app/data ... /app/secondary /app/secondary/data I want to recursively search /app , including /app/data . I do not want to search /app/secondary/data however. This what I have so far: ack --ignore-dir=data searchtext ack --ignore-dir=secondary/data searchtext The first command is ignoring both directories and the second one is ignoring neither of them. From within the app folder, what should my ack command look like? 回答1: This answer is for versions

What is generally faster, grepping through files or running a SQL LIKE %x% query through blobs?

不打扰是莪最后的温柔 提交于 2019-12-04 03:34:11
Say I'm designing a tool that would save code snippets either in a PostgreSQL/MySQL database or on the file system. I want to search through these snippets. Using a search engine like Sphinx doesn't seem practical because we need exact text matches of code when searching code. grep and ack and has always worked great, but storing stuff in a database makes a large collection of stuff more manageable in certain ways. I'm wonder what the relative performance of running grep recursively over a tree of directories is compared to running a query like SQL's LIKE or MySQL's REGEXP function over an