Like butter!!
Thank-you very much.
--Dan

On Mon, Apr 4, 2011 at 6:42 PM, Israel Chauca F.
<[email protected]>wrote:

>
> On Apr 4, 2011, at 5:31 PM, Daniel M. Eldridge wrote:
>
> > I have a file that consists of approx 400K lines and 25762K chars
> >
> > this work is the result of someone who has copied existing files onto
> itself
> > multiple times.
> >
> > In an effort to "decrypt" this mess I am:
> > a) inserting .pp to indicate paragraph beginnings
> > b) replacing sentence endings with \r so that each line consists of one
> > "sentence."
> > c) sorting all of the lines so that I can use uniq to generate a list of
> > unique sentences.
> >
> > While this works it fails to provide any context, therefore I want to
> insert
> > the line number @ the beginning of each line and follow it with a tab and
> > then have uniq ignore the first field with:
> > uniq --skip-fields=1
> >
> > or, if I pad line numbers with leading zeros I could use:
> > uniq --skipchars=6
> >
> > So my question is:
> > How do I insert the current line number into a text file; how can I do
> this
> > while padding to six digits?
>
>
> This should do the trick:
>
> :%s/^/\=repeat(0,6-len(line('.'))).line('.').'^I'/
>
> ^I represents a tab. It adds the number of zeros, the line number and the
> tab. It uses :help sub-replace-expression
>
> Israel
>
> --
> 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 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

Reply via email to