Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install ack-grep on CentOS

Tags:

centos

ack

I went through fair amount of google search to install ack-grep on CentOS but I didn't find anything help. I also looked for the source codes but couldn't find it neither. Does anyone know how to install it on the OS?

Thanks a lot.

like image 906
novo Avatar asked Feb 04 '14 19:02

novo


People also ask

What is ACK grep?

DESCRIPTION. Ack is designed as a replacement for 99% of the uses of grep. Ack searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines containing a match to the given PATTERN. By default, ack-grep prints the matching lines. PATTERN is a Perl regular expression.

How use ACK command in Linux?

The -a option tells ack to select all files, regardless of type. Some files will never be selected by ack, even with -a, including: • Backup files: Files matching #*# or ending with ~. However, ack always searches the files given on the command line, no matter what type.

What is ACK tool?

ack is a grep-like source code search tool. Designed for programmers with large heterogeneous trees of source code, ack is written in portable Perl 5 and takes advantage of the power of Perl's regular expressions.


5 Answers

Could be essentially the same as https://stackoverflow.com/a/23155007/35946 but on CentOS 6.7 the answer is:

# yum install epel-release
# yum install ack
like image 88
lkraav Avatar answered Oct 15 '22 09:10

lkraav


if you don't have the root permission, you can do as follows:

$ curl https://beyondgrep.com/ack-2.22-single-file > ~/bin/ack && chmod 0755 !#:3

or you can change to root user:

$ sudo su
# curl https://beyondgrep.com/ack-2.22-single-file > /bin/ack && chmod 0755 !#:3
like image 25
lutaoact Avatar answered Oct 15 '22 09:10

lutaoact


Go to Beyond Grep and look at the section titled

Install The ack executeable

curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3

And replace ack.2.14 with the current version of ack.

You may need to create the directory mkdir ~/bin/ first. You may also need to modify ~/.bashrc to include this new path E.G.:

PATH=$PATH:$HOME/bin
Then reload ~/.bashrc
source ~/.bashrc

Test the installation by running ack:

rpm -qa | ack s

This should display any installed packages containing the letter s. (some linux distributions may use ack-grep as the command.

like image 21
P.Brian.Mackey Avatar answered Oct 15 '22 08:10

P.Brian.Mackey


You can get it from the EPEL software repository.

From the EPEL FAQ:

For EL5:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'
...
su -c 'yum install ack'

For EL6:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'
...
su -c 'yum install ack'
like image 34
braveterry Avatar answered Oct 15 '22 10:10

braveterry


How did you try installing it? Are you using yum? The package is probably not called "ack-grep", but just "ack".

The name "ack-grep" is a Debian-specific thing because there was already a package called "ack", so they called it "ack-grep" instead. That was years ago and now they're dropping the original "ack" package and renaming "ack-grep" to "ack".

like image 29
Andy Lester Avatar answered Oct 15 '22 08:10

Andy Lester