ackã使ãã!
ã¿ãªããgrepãã¦ã¾ãã!?
便å©ã§ãããgrepãèªåã¯Linuxã触ãã¯ãããããã
grepã使ãããªããããã«ãªãã°ä¸äººåã
ã£ã¦è¨ããã¦ããªã«ãã£ã¦ãã®ãã®äººãããã¨ãæã£ã¦ãªãã§ããå ¨ç¶ã
ã¾ãä»ã¨ãªã£ã¦ã¯grepããããªãã«ä½¿ãããã§ãããã§ããã
$ find . -name "*hoge" -type -f | grep -v '\.svn' | xargs grep piyopiyo
ã¨ããã£ã¦ãã
ãªããfind|xargs|grepã¨ãã¾ãã«UNIXçã§ããããç´ æµããã
ç°¡åãªã³ãã³ããçµã¿åããã¦ã§ã£ãããã¨ãã£ã¡ããï¼ï¼ã¿ãããªï¼ï¼
ããã©ããã¼ãã£!!!
ã£ã¦ãã¨ã§ãackã使ãã¾ãããã
ackæ¨æ¥ç¥ãã¾ããã
ã§ãä»æ¥ã使ãã¯ããã¦2æ¥ç®ã
ã¨ãããããå
¬å¼(Beyond grep: ack 2.12, a source code search tool for programmers)ããããããæ訳ãã¾ããã
ââ
ackã¨ã¯ï¼
ackã¯grep ã¿ãããªãã¼ã«ã§ããã§ããã¦ãã¡ããã¡ãã®ã½ã¼ã¹ã³ã¼ããç¸æã«ãã¦ãããã°ã©ãã®ããã«ä½ããã¦ããã
ackã¯å
¨é¨Perlã§æ¸ããã¦ãããPerlæ£è¦è¡¨ç¾ä½¿ãã¡ãã!
ã¤ã³ã¹ãã¼ã«æ¹æ³
- CPAN 㧠App::Ack ãã¤ã³ã¹ãã¼ã«ãPerlã¦ã¼ã¶ãªãããã楽ã ãã
- standalone versionããããCPANã»ããã¢ããããã®ãã³ãã¯ã»ã£ã¦äººã¯ããã
- curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3 (â âãããããã)
- ãã¨ãMacportãUbuntuãFedoraãGentooãArchç¨ã«ããã±ã¼ã¸ãããã
Textmateã¦ã¼ã¶ã¸
Textmateãªããããããã®ãã©ã°ã¤ã³ããã!
Check it out at: http://github.com/protocool/ack-tmbundle/tree/master
åæ¹é¢ããåã³ã®å£°ã!
- ããï¼æé«! grepãããã£ã¨ã¤ã¤ã! (Djangoã®ä¸ã®äºº)
- ackä½ã£ã¦ããã¦ãããã¨ã!æ¯æ¥ãã¡ãã£ã¨æ¥½ãããªãã¾ããã (Alan)
- ackã«åºãã£ã¦grepã¨ã¯ãããã°ãã¾ãããç´°ããã¨ããã«æ°ãèãã! (Samuel)
- ackæé«! (redditã®Bill)
- grepã¨ãããããªã¼ãã (Thomas)
- ãããªãfind-grep-xargs (Johnson)
- --thppt ã«æãã¾ãã/// (Daring) (â $ ack --thppt ã£ã¦ãã£ã¦ã¿ãã)
- .svnç¡è¦ãã¦ãããã®ãããããã¼ã (Paul)
- standaloneãããã¸ã§ã¯ãã®devtoolsã«å ¥ãã¡ãã£ãã (Jason Gessner)
- ackã¾ããããã£ãã (Benjamin)
- grepã§ãã£ã¦ããã¨ã®90%ã¯ackã§ãã£ã¦ããã (Randall)
- ackã使ã£ã¦èº«é·ãã®ã³ã¾ããã (Jerry)
- ackã使ã£ã¦å½¼å¥³ãã§ãã¾ããã (Andrew)
grepããackã使ãã¹ã10ã®çç±
- éããæ¢ããããã¤ã ãæ¢ãããã
- å ¨é¨Perlã ããWindowsã§ãåãã
- Standalone versionãå ¥ããã°æ¨æºã¢ã¸ã¥ã¼ã«ãã使ããªãããä½è¨ãªãã¨æ°ã«ããªãã§ããã
- ããã©ã«ãã§ããªã¼å ¨ä½ãæ¤ç´¢ãã§ã.svnã¨ãã¯ç¡è¦!
- ã©ãã§ããããã¡ã¤ã«ã¯æ¢ãã¾ããã
- VCSã®ãã£ã¬ã¯ããªã¨ã
- blibã¨ã
- ããã¯ã¢ãããã¡ã¤ã«ã¨ã
- binaryã¨ãã³ã¢ãã³ãã¨ã
- .svnã¨ããç¡è¦ããããgrepããéã
- ãã¡ã¤ã«ã¿ã¤ããæå®ããã! --perlã¨ã --nohtmlã¨ã
- ack -f ã使ãã¨ãã¡ã¤ã«ã®ãã£ã«ã¿ãªã³ã°ãåºæ¥ã!
- ãã¡ã¤ã«ã®æ¤ç´¢çµæãè²ã¤ãã§ãã¤ã©ã¤ããã¦ãããã
- GNUã®ãµãã»ãããããªãã¦Perlã®æ£è¦è¡¨ç¾ã使ããã
- Perlã®ã¹ãã·ã£ã«å¤æ°ã§åºåãç¹å®ã§ããã
- $ ack '(Mr|Mr?s)\. (Smith|Jones)' --output='$&'
- ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ãgrepã¨ä¼¼ã¦ããã
- -w ã¯åèªã®ã¿
- -c ä¸è´ããè¡æ°ã®è¡¨ç¤º
- -l ãããããè¡ã§ã¯ãªããã¡ã¤ã«åã表示
- ãgrepããã25%ãçã!ãgrep -rããã50%ãçãã
(...ãªãã§13ãããã ã)
è£è¶³
ãã¹ã¦ã®ãã¡ã¤ã«ãæ¤ç´¢
æ¡å¼µåãªãã®ãã¡ã¤ã«ããæ¢ãã¨ãã¨ãã¯-aä»ããã°æ¤ç´¢å¯¾è±¡ã«ãªãã¾ãã
.ackrc
ãã¨ãã°ãphpæ¸ãã¦ããã ãã©ãä¸ã«æ¡å¼µåãhogeã¨ãbarã¨ãã®ãã¡ã¤ã«ããããã ããã¼ãã£ã¦ã¨ãã¯
ã~/.ackrcã«æ¸ããã¨ãããããªå
·åã
emacsãã
emacserãªã使ã£ã¦ãããfind-grep(grep-find)ã
ããã®ã³ãã³ãã"ack --nocolor --nogroup" ã«å
¥ãããã¡ããã°emacsããackã使ãã¡ãã!
grep-findããæç¶ããããã§ãã.svnãhoge~ã#hoge#ãç¡è¦ãã¦ãããããã¤ããªãç¡è¦ãã¦ãããã
ack.elãªãã¦ã®ããã£ããããã使ãã¨ããããããªãããªã
ãããªãfind-grepãä»ã¾ã§ã©ãã使ãããã
http://repo.or.cz/w/ShellArchive.git?a=blob_plain;hb=HEAD;f=ack.el
以ä¸ãackã®ç´¹ä»ã§ããã