Thursday, January 27, 2011

Grep command in vim(Need help )

I want to copy the line in a file which contains "ERROR" and also one line
below into another file .Is it possible

i am doing like this
:g/ERROR/#2 ==> This will display the line contains ERROR and also the
below line

I need those display staements in a file .How to do that?

Actually i am doing from the terminal like this

vim -c "argdo g/ERROR/#2 | update " *.vcs.log > result.log
It gives error .
Can anybody help me out guys


If possible i want toadd file name also in the resultfile

Result.log file should look like this

a.vcs.log ===> This should be filename
ERROR ::
Mismatch at xyz
ERROR::
Mismatch at yz

xyz.vcs.log ===>2nd filename
ERROR::
Mismatch at ghkj
ERROR::
Mismatch at hjlkj

--Can anybody do this


--
View this message in context: http://vim.1045645.n5.nabble.com/Grep-command-in-vim-Need-help-tp3359594p3359594.html
Sent from the Vim - General mailing list archive at Nabble.com.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: