When I use grep
to find some text which I need, it will display lines containing a match to the given pattern.
For example,
# grep -r ".*Linux" *
path0/output.txt:I hope you enjoyed working on Linux.
path1/output1.txt:Welcome to Linux.
path2/output2.txt:I hope you will have fun with Linux.
then, I want to edit the file path2/output2.txt
, hence, I type vim path2/output2.txt
.
But, I don't think it is an effective way.
How can I copy the path after grep
?