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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:05:14+00:00 2026-05-20T05:05:14+00:00

All is in the title : here is the string pattern of a multi-line

  • 0

All is in the title :

here is the string pattern of a multi-line file:

foo_bar_alpha = "a1b2c3_cat_andthis"  
barfoo_bar_alpha = "just a int number"  
loremfoo_bar_beta = "192.168.0.0"  
... other lines come here ...

Using sed (and/or awk and/or perl), I need to substitute char “_” with “.” , but only in the first part of the string, which is right delimited by “=”, and keep the 2nd part (after “=”).

Sthg like :

sed "s/(.*)=(.*)/ \1 with "_" replaced by "." = \2/g" < my_file
                   ¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
                          how to do that ?

Thx in adv.

  • 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-20T05:05:14+00:00Added an answer on May 20, 2026 at 5:05 am
     awk '{gsub("_",".",$1)}1' ./infile
    

    Input

    $ cat ./infile
    foo_bar_alpha = "a1b2c3_cat_andthis"
    barfoo_bar_alpha = "just a int number"
    loremfoo_bar_beta = "192.168.0.0"
    

    Output

    $ awk '{gsub("_",".",$1)}1' ./infile
    foo.bar.alpha = "a1b2c3_cat_andthis"
    barfoo.bar.alpha = "just a int number"
    loremfoo.bar.beta = "192.168.0.0"
    

    *Note: If you for sure need to delimit on = because your variable names somehow contain spaces (highly doubtful) then this works:

    awk -F= '{gsub("_",".",$1)}1' OFS="=" ./infile
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is what I have: public interface IEvent { int Id string Title }
Sorry for the confusing title, but it basically says it all. Here's the structures
I have the following string: h3. My Title Goes Here I basically want to
The title explains all... I have this snippet of code in my application: String
well, the title pretty much says it all. here's a little info: i have
I believe the title already says it all, but here is my question: what
This is example of my XML file <head> <cat>some title here... <info>some info here
I'm kinda stuck here. I have this pattern: <a class=title href=showthread.php?t=XXXXX id=thread_title_XXX>DATADATA</a> I know
Here is the input string: #video:firstVideo.mp4# #video:secondVideo.mp4 title:Title of second Video# #video:thirdVideo.mp4# I want
I'm having an issue here, I am trying to get all the titles from

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.