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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:32:30+00:00 2026-05-11T02:32:30+00:00

I have a file that contains this kind of paths: C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable

  • 0

I have a file that contains this kind of paths:

C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable subdir count]\foo.c 

And I would like to get the following file:

C:\bad\foo.c C:/good/foo.c C:/good/bar/foo.c C:/good/bar/[variable subdir count]/foo.c 

Note that the non matching path should not be modified.

I know how to do this with sed for a fixed number of subdir, but a variable number is giving me trouble. Actually, I would have to use many s/x/y/ expressions (as many as the max depth… not very elegant).

May be with awk, but this kind of magic is beyond my skills.

FYI, I need this trick to correct some gcov binary files on a cygwin platform.


I am dealing with binary files; therefore, I might have the following kind of data:

bindata\bindata%bindataC:\good\foo.c 

which should be translated as:

bindata\bindata%bindataC:/good/foo.c 

The first \ must not be translated, despite that it is on the same line.

However, I have just checked my .gcno files while editing this text and it looks like all the paths are flanked with zeros, so most of the answers below should fit.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T02:32:31+00:00Added an answer on May 11, 2026 at 2:32 am
    sed -e '/^C:\\good/ s/\\/\//g' input_file.txt 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file that contains this <!-- CordovaVersion --> I want to replace
Ok, so I have this .htaccess file that contains this <IfModule mod_rewrite.c> RewriteEngine On
I have a File that COntains Strings in This Format: ACHMU)][2:s,161,(ACH Payment Sys Menus
I have an xml file that contains a structure.. In this structure, I have
I have create a vcf file that contains contacts by using this code ContentResolver
I have a HTML that includes a Javascript file. This script contains a special
I have a file that contain lines that looks like this: >AF001546_1 [88 -
I have a file that contain list of numbers that looks like this: 10^-92
I have a file that might contain a line like this. A B //Seperated
I have a file that contains: foo1 = 1 foo2 = 2 foo3 =

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.