Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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