Inserting a character in certain column

Szemerédy Gábor gaborszem at eccf.su.ac.yu
Tue Feb 26 16:31:33 UTC 2008


Michael Ulm wrote:
> Alexandra Zaharia wrote:
>   
>> On 2/25/08, Szemerédy Gábor <gaborszem at eccf.su.ac.yu> wrote:
>>     
>>> Hello list!
>>>  I need to insert a character in certain column in all rows of the file
>>>  using vi.
>>>  Please help
>>>
>>>       
>> If I understand correctly, suppose you have the file
>>
>> aaaa
>> bbbb
>> cccc
>> dddd
>>
>> and you want to turn it into
>>
>> aaaXYa
>> bbbXYb
>> cccXYc
>> dddXYd
>>
>> Then here's what you have to do in vi:
>>
>>     
> --snip--
>
> or use a regexp substitution. In command mode type
>
> :%s/^.\{3}/&XY/
>
> HTH,
>
> Michael
>
>   
Thank you but it gives me
"RE error : parentheses not balanced.
Gabor




More information about the ubuntu-users mailing list