Tuesday, January 28, 2014

Re: how to delete lines containing a pattern and not containing another pattern?

On Tuesday, 28 January, 2014 at 09:17:56 GMT, Arun E wrote:
>On Friday, January 24, 2014 4:02:05 AM UTC-8, Chan Kim wrote:
>> :v /sparc/s/.*arch.*\n//
>
>Careful with line deleting substitutions when using :g/:v. It will not work always:
>For eg. with a file like this
>--
>Line 2 : arch sparc asd
>Line 3 : arch arm
>Line 4 : arch aaa
>---
>..the "arch aaa" will not be deleted.

Remove the \n from the command and the last line is removed. However, aren't all lines, including the last, unless in binary mode, appended with a newline? For example, write a new file such as above, cat it and you'll see a newline at the end (the shell prompt is on a new line). 'set list' shows the end of line marker ($) (as does 'cat -E'), but not specifically a newline marker. How to have vim show newlines with 'set list'? I don't see it in listchars.

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: