-1

I want to use vi to quickly edit text.

there is the format on lines m to n of the file.

    .lut_da_25,
    .abc_we23,
    ...
    .yy_ewe,

I want to edit the above lines to the following

    .lut_da_25(lut_da_25),
    .adc_we23(adc_we23),
    ...
    .yy_ewe(yy_ewe),

is there a quick method in vi to achieve the above functions?

2

I think something like

%substitute/\.\(\w\+\)/&(\1)/

Would do it. Assumptions: comma is not a “word” character (?), no more than one record per line.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.