> I have I file that is something like:
> 
> ASN       144
> ASN       144
> HIS         145
> HIS         145
> LEU        146
> LEU        146
> 
> Actually it has many more columns. I want to change that to:
> 
> ASN             1
> ASN             1
> HIS               2
> HIS               2
> LEU              3
> LEU              3
> 
> That means, I want to subtract 143 from each value on the columns, and
> write the result. Furthermore, the file contain other columns which I
> don't want to modify. I have done scripts for that, but could that be
> done with the substitute command of vim?

Yep...

   :%s/^\w\+\s\+\zs\d\+/\=submatch(0) - 143

(the \zs indicates where the replacement starts)

-tim





--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to