On 2018-02-02 10:45, Bernard Fay wrote:
> I have a file with a bunch of lines like the following one:
> 
> AAE ..........................................Above Aerodrome
> Elevation
> 
> I would like to replace the dots by a single tab.
> 
> I tried the following substitutions but it does not work.
> %s/\.*/\t/
> %s/[\.]*/\t/

Because you're using "*" instead of "\+", it is likely finding the
zero periods at the beginning of the line, transforming it into

\tAAEE ......... Above Aerodrome Elevation

What you likely want is to require more than one period with either

  %s/[.]\+/\t

or

  %s/\.\+/\t

If for some reason a period appears in the abbreviation on the left
("A.A.E. ....... Above Aerodrome Elevation"), you can require a
minimum number of them:

  :%s/\.\{4,}/\t

to require at least 4 consecutive periods for the replacement.

Additionally, you might want to eat whitespace on either side of it
too:

  :%s/\s*\.\{4,}\s*/\t

just to clean it up a bit.

-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

--- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to