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 288021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:46:42+00:00 2026-05-12T05:46:42+00:00

I have this column in a file I’m editing in VIM: 16128 16132 16136

  • 0

I have this column in a file I’m editing in VIM:

16128
16132
16136
16140
# etc...

And I want to convert it to this column:

0x3f00
0x3f04
0x3f08
0x3f0c
# etc...

How can I do this in VIM?

  • 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-05-12T05:46:42+00:00Added an answer on May 12, 2026 at 5:46 am

    Use printf (analogous to C’s sprintf) with the \= command to handle the replacement:

    :%s/\d\+/\=printf("0x%04x", submatch(0))
    

    Details:

    • :%s/\d\+/ : Match one or more digits (\d\+) on any line (:%) and substitute (s).
    • \= : for each match, replace with the result of the following expression:
    • printf("0x%04x", : produce a string using the format "0x%04x", which corresponds to a literal 0x followed by a four digit (or more) hex number, padded with zeros.
    • submatch(0) : The result of the complete match (i.e. the number).

    For more information, see:

    :help printf()
    :help submatch()
    :help sub-replace-special
    :help :s
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly large Excel file. In this file there is a column
I have this .csv file: ID,GRADES,GPA,Teacher,State 3,C,2,Teacher3,MA 1,A,4,Teacher1,California And what I want to do
I have this sp. I just found out that M.MDS_FILE column, contains a file
I have this string in my data file (dat.txt) => 00000 10101 I want
I have this xml file, and now i will want to add new entries
I have a long file which is written as ONLY one column. This column
I have to extract columns from a text file explained in this post: Extracting
In mysql database i have this column called: Name: Date Type: datetime I have
I have this query and I get error Operand should contain 1 column(s), whats
I have this table: ID(INT) DATE(DATETIME) Under the DATE column there are a lot

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.