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

  • Home
  • SEARCH
  • 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 8051759

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:22:25+00:00 2026-06-05T07:22:25+00:00

This has been a real problem for me with sed. I have an original

  • 0

This has been a real problem for me with sed.

I have an original input file as following.

R shthk     0.900000                                                            
R mue       0.054100                                                            
R nue       0.121400                                                            
R oue       0.137700                                                            
R ystress  150.23000 

I have a file which has the name of Friction1.k and has a single value of 0.123200.

I want to change the value of mue during my simulation to the value given in that file.

I use the following sed script.

sed '/\<mue\>/!d;=;s/.* \([^ ]\+\).*/\1/;R Friction1.k' dynaRcoupledmodel.k |
sed 'N;N;s|\n|s/|;s|\n|/|;s|$|/|;q' >temp.sed
sed -i -f temp.sed dynaRcoupledmodel.k

so it changes to

R shthk     0.900000                                                            
R mue       0.123200148                                                            
R nue       0.121400                                                            
R oue       0.137700                                                            
R ystress  150.23000   

The software is very strict regarding its format so the time I use this command that 148 or 155 or 159 comes extra and I get the error that the
*PARAMETER has tried to change the intrinsic TIME.

Earlier it worked fine for me but now this is giving the error.

I checked temp.sed and that number is also there but how to avoid it ?

I dont know why this number comes extra , from where it is coming but it is a problem for me.
Can any expert help me with that?

best regards

  • 0 0 Answers
  • 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-05T07:22:27+00:00Added an answer on June 5, 2026 at 7:22 am

    Why sed, you can do all that in single awk line like this:

    awk -v DATA=$(<Friction1.k) '($2=="mue"){$3="      " DATA}1' dynaRcoupledmodel.k
    

    OR

    awk -v DATA=$(<Friction1.k) '($2=="mue"){$3=sprintf("%14s",DATA)}1' dynaRcoupledmodel.k
    

    OR even better since it preserves whitespaces

    awk -v DATA=$(<Friction1.k) '($2=="mue"){sub($3,DATA)}1' dynaRcoupledmodel.k
    

    OUTPUT:

    R shthk     0.900000                                                            
    R mue       0.123200
    R nue       0.121400                                                            
    R oue       0.137700                                                            
    R ystress  150.23000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running the following code on a file that has been uploaded to this
this is not a real example, it is something that has been bugging me
This has been a rather problematic issue on numerous occasions. We have alot of
This has been driving me crazy for the past few minutes I have a
This has been driving me nuts. I keep getting the following exception System.InvalidOperationException: The
EDIT following resolution, this has been substantially edited to dump irrelevant detail and explain
This has been posted, but I've tried lot of solutions found on SO and
This has been really frustrating for me so I'll try explain what I know
This has been bugging me for a good hour. I'm starting out with Telerik
This has been asked before , but even after implementing that solution, problems remain.

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.