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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:39:58+00:00 2026-05-24T07:39:58+00:00

File I need to modify contains the following: block: 16, size: 16, start: 8,

  • 0

File I need to modify contains the following:

block: 16, size: 16, start: 8, length: 4

I’d like the file so that values for block, size will be divided by 2 while values for start, length will be multiplied by 2.

Since I have to make such modifications for a whole bunch of files, I am considering using Sed to do the substitution work for me. But I’m not sure calculations are allowed in the matching and substituting process.

  • 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-24T07:39:58+00:00Added an answer on May 24, 2026 at 7:39 am

    I always try to solve every problem tagged with sed using sed. But here it would be so easy to accomplish what you are trying to do with awk. (And the use of sed in this case is too difficult.) So, here is my solution using awk:

    $ echo "block: 16, size: 16, start: 8, length: 4" | awk '{
        printf "%s %d, %s %d, %s %d, %s %d\n", $1, $2/2, $3, $4/2, $5, $6*2, $7, $8*2
    }'
    block: 8, size: 8, start: 16, length: 8
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to modify an MSI file, and I'd like to do it in
After build, I need to modify an HTML file that points the client to
I have a text file I would like to read in that contains rows
I have a config file that contains a list of strings. I need to
I have an xml file I need to modify: ... </web-app> I want to
I need to modify a text file from multiple .NET processes, nothing I've tried
I'm in need of a way to modify an unattend.xml file programmatically. It would
I have a ASP.NET website that references another project with contains as resx file.
For example: MyApp is a web app that contains a properties file (server.properties) that
i'm having an xml file like <Root> <Child Name=A /> </Root> i need to

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.