I am using VIM Renamer plugin to bulk rename files,
I want to replace

E008_r5_Haz_Area_Class NAT GAS.pdf
E010_r4_Haz_Area_Class MP STEAM.pdf


E008_NG_Hazd Area Class_R2.pdf
E009_MDEA_Hazd Area Class_R4.pdf
E010_SYNGAS _ REFRIG_Hazd Area Class_R4.pdf
E011_Reform _Hazd Area Class_R3.pdf
E012_Air Cooler_Hazd Area Class_R3.pdf
E013_Air Cooler_Hazd Area Class_R3.pdf

Process is as below,

  1. column mode, select complete line except ".pdf".
  2. column replace new names as files are in order only.
  3. Issue :Ren command to replace all file names.

I was manually doing it for single lines but I have more than 1000 files to rename. Appreciate any help here, I want to learn vim syntax but managing chemical engineering work and learning vim is too steep for me. Appreciate if I can have little explanation.

  • 5
    There's no clear pattern in the replacements, so I'm not sure I see a way to come up with a :substitute or similar command to automate this. I'm not to sure what "column mode" is—do you mean visual-block mode (the mode entered by <C-v>)?
    – D. Ben Knoble
    Apr 26, 2021 at 19:15
  • Thanks for reply, i missed to capture first line. before and after cases are same only except file name is different. Column mode is same as visual block mode.
    – nirag
    May 6, 2021 at 15:08
  • Can you be more explicit how to translate the input to the output? For example, the last line (E013_r3_Haz_Area_Class.pdf) rearranges the words in the input but also adds the words Air Cooler -- where does that come from? May 7, 2021 at 23:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.