3 ms·
`find` is beautiful, no discussion. Together with tools like xargs there's hardly anything you can't do with it. Following is slightly off-topic but for search
by pstadler 15y ago
`find` is beautiful, no discussion. Together with tools like xargs there's hardly anything you can't do with it.
Following is slightly off-topic but for searching inside files like
find . -name "*.css" -exec grep -l "#content" {} \;
try `ack` instead
ack --css '#content'
Above command will recursively search for '#content' in all css files under the current directory. It is faster than grep and does automatically exclude your hidden version control folders. No need to mess with `--exclude`. I really stopped using grep at all.
ack can be found here: http://betterthangrep.com/ http://betterthangrep.com/
- deleted 15y ago[deleted]
- Groxx 15y agoInteresting... would love to use it, but I'm using haml and sass files, and I can't seem to --type-add anything. I get this: > ack --type-add haml=.haml ack: --type-add: Type "haml" does not exist, creating with ".haml" ... ack: No regular expression found. followed by being unable to use the type, and not showing it in --help types. Am I using it incorrectly? I got it via `brew install ack`, so that could be the problem as well. edit: --type-set=haml=.haml in a .ackrc file works. Though I may have to tweak it to look in the current directory as well - not all projects need the same settings, and in `~` it's not git-able.
- shabble 15y agoif you want a dir-specific one, you could specify export ACKRC=./.ackrc.local as an env variable, and then create that file where-ever you need to override default behaviour, otherwise it'll use ~/.ackrc The downside to doing it this way is that you only get one or the other, you can't (afaik) load ~/.ackrc, and then only override certain aspects of it locally. Also, you're constrained to running it from the basedir of your project. (You might be able to overcome this with a hack based on PROMPT_COMMAND (for bash), or a precmd/preexec function for zsh), which redefines ACKRC appropriately. Regarding the 'gitability' of it, there's no reason why you can't have a ~/.dotfiles/ackrc, with a symlink to ~ That's how I manage my dotfiles anyway, along with a makefile to create any missing symlinks. Something like http://kitenet.net/~joey/code/etckeeper/ http://kitenet.net/~joey/code/etckeeper/ might work out even better, although I've never really found time to play with it.