I know that vim has the built in :grep command that does what you describe. The results are listed in the preview window and pressing enter will open the corresponding file and place the cursor at the desired line.
The trick I described is more for when you're dealing with some unusual program that wouldn't work with :grep - at least not without fiddling with 'grepprg' to invoke it, and/or 'grepformat' to correctly interpret its output.