On 11/09/12 00:21, vicky b wrote: > HI , > > I have the file which has key value pair, for single key there are four > entries i want align all the values hoirzontall > > file contains > > alert_pref_email Nh?n các c?nh báo thông qua th? ?i?n t? > alert_pref_email Receive the Alerts through Email > alert_pref_email Terima informasi penting melalui Email > alert_pref_email ?????????????????????????? > alert_pref_email Nh?n các c?nh báo thông qua th? ?i?n t? > > output i would like to have like this > > alert_pref_email Nh?n các c?nh báo thông qua th? ?i?n t? Receive the > Alerts through Email Terima informasi penting Nh?n các c?nh báo thông qua > th? ?i?n t?
If the lines are sorted/adjacent in the file, you can use :%s/^\(\S\+\)\(\s.*\)\n\1\s\+/\1\2 / (you might have to run it multiple times since it will halve adjacent matches). Alternatively, you should be able to use :%s/\%(\1\s.*\)\@<=\zs\n\(\S\+\)\>/ which seems to do them all in one pass. (In doing this one, I learned that back-references *can* come before the capturing-group as long as it's a perl-like "and this other atom must match before here"; normally referencing \1 before capturing gets you an "E65: Illegal back reference" error) -tim -- 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
