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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:29:00+00:00 2026-05-29T20:29:00+00:00

On OSX, running sed to edit in place works by passing a zero-length argument

  • 0

On OSX, running sed to edit in place works by passing a zero-length argument like this:

find . -name "*.java" -print | xargs sed -f src/main/scripts/remove_snippets.sed -i ""

However, putting the -i "" into a shell variable does not work:

dashi='-i ""'
find . -name *.java -print | xargs sed -f src/main/scripts/remove_snippets.sed $dashi

Instead of editing in place the "" gets interpreted as a literal string to use for the backup extension, leaving a directory of java files named *.java"".

How can bash be told to interpret the "" as an empty argument rather than an argument containing two double-quotes?

  • 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-29T20:29:02+00:00Added an answer on May 29, 2026 at 8:29 pm

    Use an array.

    dashi=(-i "")
    find . -name *.java -print | xargs sed -f src/main/scripts/remove_snippets.sed "${dashi[@]}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running Mac OSX Snow Leopard, this problem is caused by a recent train
So I'm running Mac OSX Lion and I recently installed Eclipse IDE for Java
Trying to install Scrapy on Mac OSX 10.6 using this guide : When running
In a recent question it was noted that on OSX running sed on a
I'm using FDT 3 enterprise with Flex 4.5 SDK on Mac OSX Running works
I'm running OSX 10.6, and I have this very simple script in a file
This is the error that I get after typing import serial. I'm running osx
I'm Running OSX. Thought I could find documentation somewhere, but could not.
I am running OSX Lion and have installed python2.7 from python.org (this distribution can
I recently installed python 2.7.2 on my Mac running OSX 10.6.8. Previously, I had

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.