On Thu, 2006-05-25 at 10:55 +1000, Tien Pham wrote:
> 
> I have a very large file containing 7000 lines of data in a single
> column. Below is a sample. Many of them are 7 digit numbers and
> others are 8 digit numbers. For those 7 digit numbers, I need to add
> number 0 at the beginning of it. Can someone please show me a
> command to do it all in one hit? Those 7 digits numbers have no
> regular patterns, except that they have 7 digits, and the order of
> all numbers in the column has to remain unchanged.

  %s/^\(\d\d\d\d\d\d\d\)$/0\1/ge

See

  :help :substitute
  :help pattern-overview


-- 
Steve Hall  [ digitect mindspring com ]
:: Cream... something good to put in your Vim!
::   http://cream.sourceforge.net

Reply via email to