2

I did a ack-grep on files that contain a string. I then want to open these files in a VIM veritcal split window view. How can this be done via the terminal?

5

First you would need to output the filename and paths of the files that contain the matched text your looking for:

ack -ail "my text"

a = all files i = insensitive case l = output only filesname paths

You combine that line with the following shell expansion script:

vim -O $(ack -ial "my text")

O = open files in a split window view. or E = open files in horizontal split view.

The output will be like this: enter image description here

1
  • Please note that if you're using ack -a to get a list of files, you should probably just be using grep. In fact, ack 2.0 does away with the -a flag. – Andy Lester Aug 11 '13 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.