Inserting a character in certain column
Michael Ulm
michael.ulm at isis-papyrus.com
Mon Feb 25 15:00:20 UTC 2008
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
More information about the ubuntu-users
mailing list