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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:12:12+00:00 2026-06-06T15:12:12+00:00

This is for the Apple platform. My end goal is to do a find

  • 0

This is for the Apple platform. My end goal is to do a find and replace for a line inside of the firefox preference file “prefs.js” to turn off updates. I want to be able to do this for all accounts on the Mac, including the user template (didn’t include that in the examples). So far I’ve been able to get a list of all the paths that have the prefs.js file with this:

find /Users -name prefs.js

I then put the old preference and new preference in variables:

oldPref='user_pref("app.update.enabled", false);'
newPref='user_pref("app.update.enabled", true);'

I then have a “for loop” with the sed command to replace the old preference with the new preference:

for prefs in `find /Users -name prefs.js`
  do
  sed "s/$oldPref/$newPref/g" "$prefs"
done

The problem I’m running into is that the “find” command returns the full paths with the stupid “Application Support” in the path name like this:

/Users/admin/Library/Application Support/Firefox/Profiles/437cwg3d.default/prefs.js

When the command runs, I get these errors:

sed: /Users/admin/Library/Application: No such file or directory
sed: Support/Firefox/Profiles/437cwg3d.default/prefs.js: No such file or directory

I’m assuming that I somehow need to get the “find” command to wrap the outputted path in quotes for the “sed” command to parse it correctly? I’m I on the right path? I’ve tried to pipe the find command into sed to wrap quotes, but I can’t get anything to work correctly. Please let me know if I should go about this differently. Thank you.

  • 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-06-06T15:12:13+00:00Added an answer on June 6, 2026 at 3:12 pm

    You don’t want to for prefs in ... on a list of files that are output from find. For a more complete explanation of why this is bad, see Greg’s wiki page about parsing ls. You would only use a for loop in bash if you could match the files using a glob, which is difficult if you want to do it recursively.

    It would be better, if you can swing it, to use find ... -exec ... instead. Perhaps something like:

    find /Users -name prefs.js -exec sed -i.bak -e "s/$oldPref/$newPref/" {} \;
    

    The sed command line is executed once for each file found by find. The {} gets replaced with the filename. Sed’s -i option lets you run it in-place, rather than requiring stdin/stdout. Check the man page for usage details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm confused by this: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#//apple_ref/doc/uid/20002174-178830-BAJEDEFB Supposing @interface Office : NSObject { NSMutableArray *employees; }
So let's say I have this array: $requiredFruit= @(apple,pear,nectarine,grape) And I'm given a second
Suppose I have a collection of files like this: echo -e apple\n cherry >>
This is unmodified code from Apple's iPhone 'Utility Aplication' template: - (void)applicationDidFinishLaunching:(UIApplication *)application {
In an Apple example I've seen this: myController *controller = [viewControllers objectAtIndex:page]; if ((NSNull
Got this code for a viewscroller from the apple developers site. @synthesize scrollView1, scrollView2;
Here in Apple's sample code I found this type of persistence storage. Can anyone
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
I've googled the crap out of this and can't find any solutions. It happened
It seems that Apple has so far gone the furthest of any mobile platform

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.