Hi, In a tab delimited data file I want to replace empty fields with \N. I wasn’t getting the result I expected and began working with a simple test file that looked as follows with set list:
^I^I^I^I^I$ ^I^I^I^I$ ^I^I^I$ ^I^I$ ^I$ $ The desired result would be: \N^I\N^I\N^I\N^I\N^I\N$ \N^I\N^I\N^I\N^I\N$ \N^I\N^I\N^I\N$ \N^I\N^I\N$ \N^I\N$ \N$ What I started with, and what seemed the most obvious way to do it, doesn’t work, leaving the final field of multi-field lines unfilled: %s/\(^\|\t\)\@<=\(\t\|$\)\@=/\\N/g The following works, the only difference being the match on end-of-line instead of end-of-line at end of pattern with zero width: %s/\(^\|\t\)\@<=\(\t\|\n\)\@=/\\N/g Using zs and ze instead of @<= and @=, the following did not work, strangely leaving the second field of multi-field lines unfilled: %s/\(^\|\t\)\zs\ze\(\t\|$\)/\\N/g Both of the commands above that failed achieve the desired result if executed repeatedly until the command returns E486: Pattern not found: …. Vim is v7.3.429 as packaged for the Lubuntu 12.04 repositories. Am I misunderstanding something or is Vim not handling this correctly? Thanks for reading along and any help you may offer. John Slattery -- 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
