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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:41:44+00:00 2026-05-16T11:41:44+00:00

On Linux sed -i will modify the input files in place. It doesn’t work

  • 0

On Linux sed -i will modify the input files in place. It doesn’t work on Solaris, though.

sed -i '$ s/OLD/NEW/g' test        
sed: illegal option -- i

What can I use in place of sed -i on Solaris?

  • 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-16T11:41:44+00:00Added an answer on May 16, 2026 at 11:41 am

    You’ll need to replicate -i‘s behavior yourself by storing the results in a temp file and then replacing the original file with the temp file. This may seem inelegant but that’s all sed -i is doing under the covers.

    sed '$ s/OLD/NEW/g' test > test.tmp && cat test.tmp > test && rm test.tmp
    

    If you care you could make it a bit more robust by using mktemp:

    tmp=$(mktemp test.XXXXXX)
    sed '$ s/OLD/NEW/g' test > "$tmp" && cat "$tmp" > test && rm "$tmp"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is similar to Linux GREP/SED [xargs] find pattern and line number in files
I am new to linux and am trying to parse a bunch of files
I search a tool(chain) (sed/bash/...) in Linux, to achieve the following: Go through a
I am attempting to replace multiple lines using sed on a Linux system Here
I'm trying to use the linux sed command to append a path element to
I hope the below task will be very easy for sed lovers. I am
I have heard that setting the --prefix=PREFIX option when compiling PHP on linux will
In my bash script, i am trying to execute following Linux command: sed -i
I know it doesn't matter what the file extentions are in linux but what
I am new to Linux as a whole and so far I have not

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.