Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8632415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:20:58+00:00 2026-06-12T09:20:58+00:00

I often do some operations on set of string and generally I it works

  • 0

I often do some operations on set of string and generally I it works well with a regex in Notepad++. A long time ago I remember using some tool which could record an action and perform same operation. For example lets say I have this string . Please keep in mind this is just an example.

First Name,Last Name,Social Security 

I want to convert it to the following:

first_name("First Name"),last_name("Last Name"),social_security("Social Security")

Is there any way to do this using some text editor? I have these type of requirements too often. I remember using vim for something similar.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:21:00+00:00Added an answer on June 12, 2026 at 9:21 am

    It can be accomplished using vim macros, but a “simple” substitution fits better

    :s/\(^\|,\)\(\S\+\) \(\S\+\)\(,\|$\)/\l\2_\l\3("\2 \3")/g
    

    Or you can use awk (sed, whatever) for this from within vim, like:

    :%!awk 'BEGIN {FS=","} { print whatever you modified your columns }'
    

    With macro, something like qayt,Pi("ESCf,i")ESCF2SPACEr_l~0~q

    But this only partially works… (for the first column) Basically:

    1. qa records macro into a register
    2. yt, (assuming we are on the first char in the line, this yanks till the first ,
    3. P puts the yanked test right before the actual cursor position (that is the first char on the line)
    4. (cursor position maintained) i("ESC inserts (", then leaves insert mode
    5. f,i")ESC finds the next space and insert ") before
    6. F2SPACEr_ finds the second space backwards, and replaces with _
    7. l~0~q moves to next char then change its case to lower, then moves to first char of line, and change that’s case as well, then finally exit recording macro.

    Then run your macro from normal mode via @a.

    Vim is very capable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Often times I write some SQL like this: string sql = @ -- Multi-line
While doing some refactoring I've found that I'm quite often using a pair or
I often find myself using lambdas as some sort of local functions to make
I often found some backgrounds like this: http://knplabs.de/bundles/knpcorporate/images/bg-intro.png The whole page is: http://knplabs.de How
when i read through source files of opensource projects i often come across some
Often we have to use some of the methods which don't return anything useful.
Often i like default android style defined for some widget. Often i like to
I have some scripts that get run often, always from within a connected SQLPlus
Often when writing PHP I'll have it output some HTML like this - echo
More often than I like when designers edit some of our sites' pages, they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.