more powerful grep – ack
| Hot: |
For last couple of days, I have been using ack instead of grep. Here is description of ack:
Ack is designed as a replacement for grep.
There are couple of reasons I am using ack. First and foremost being it does not require a filename. So, for seaching amit in all files recursively under the current directory I can simply use
ack amit
More reasons to use ack:
It supports pager option and there can be a rc file that can be used to define the default options that needs to be used with ack. Here is the contents of my $HOME/.ackrc file.
–pager=most
–color
–sort-files
-u
-H
–context=3
–all
SO, basically when I do the search, the output is piped to most command and there are 3 context lines displayed for the search. The filename too is displayed for the search result and the output is colored. There are other options used in the rc file, that you can see in the man page for ack.
Now if I had to do that with grep, I would need a function for grep or an alias but this is much cleaner. Ain’t it. What do you think, leave a comment to tell me.
You need to install ack with the following command:
sudo yum install ack
Originally posted 2009-08-24 21:36:30.
related post
- My Images
- BDay Snaps
- Nature
- Get the information on all the rpms installed on the system
- Bash Tips & Tricks
Related Posts -
GCompris -- Kids games and learning activities and hacks. I found a nice game and learning software for Kids... -
Edit a File When You Are Viewing It Using more / less Command Aritcle here. Edit a File When You Are Viewing It...
Related Websites - Selecting Keywords For Internet Strategy If you are starting your site from scratch, selecting keywords...
- Tips for Organizing the Garage 1 - Begin by creating a staging area. If you...































