I was just wondering if anyone could help out with how to do the following using vi.
I have a text file and it might contain something like
start of text file:
--something1.something2--
--anotherThing1.something2--
end of text file:
If I want to take this line and convert it by way of searching for anything matching the first occurrence of [A-Za-z0-9] copy that to the buffer then append it on the same line to before the first occurrent of —
start of text file:
--something1.something2.something1--
--anotherThing1.something2.anotherThing1--
end of text file:
Is there a single VI command to do this?
Cheers
Ben
or without asking confirmation for every replace:
will produce:
from:
This is if you want to copy the first word after ‘–‘ up to first ‘.’ and append ‘.’ and word found before the last ‘–‘.
Using vim.
RE COMMENTS:
Someone mentioned that it will not work when there are multiple words and so on.
I tested it on the following:
after replace with the above expression: