Find the answer to your Linux question:
Results 1 to 3 of 3
I have a code in which there are some variables with pattern like ABCD_DEF_XYZ ABCD_DEF_123 ABCD_DEF_PQR and I want them to be changed to ABCD_DEF_XYZ_XYZ ABCD_DEF_123_123 ABCD_DEF_PQR_PQR . How can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2012
    Posts
    23

    vim or perl regex for search and replace


    I have a code in which there are some variables with pattern like
    ABCD_DEF_XYZ ABCD_DEF_123 ABCD_DEF_PQR and I want them to be changed to ABCD_DEF_XYZ_XYZ ABCD_DEF_123_123 ABCD_DEF_PQR_PQR . How can I do it in vim and in perl.

    Sub question. Is there any way I can store the last part in some variable in perl and then use append function ? Ex match ABCD_DEF_XXX store XXX then apend it again to ABCD_DEF_XXX so that it becomes ABCD_DEF_XXX_XXX?

  2. #2
    Linux Newbie
    Join Date
    Nov 2012
    Posts
    211
    why would you use vim on a string? vim is designed to operate on files.

  3. #3
    Just Joined!
    Join Date
    Apr 2012
    Posts
    23
    I am using Vim as an editor and the variables are in C -code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •