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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:38:28+00:00 2026-06-10T11:38:28+00:00

If anyone is good with regex patterns, replacing strings and bash – you could

  • 0

If anyone is good with regex patterns, replacing strings and bash – you could do me a big favour:

I have a bunch of source files in a directory that have this line in various places. The line may well be preceded by spaces.

RELEASE_AND_NIL(_theNameOfAVariable);

I want to convert all occurences, overwriting the files with:

[_theNameOfAVariable release];

..any pointers please? I think someone showed me how to do this before with sed, but I forgot it was that long ago.

Thanks

EDIT

The actual command I used in the end was: (Thanks to @fardjad)

 find . -name '*.m' -print0 | xargs -0 sed -i "" "s/RELEASE_AND_NIL(\(.*\))/[\1 release\]/g"
  • 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-10T11:38:31+00:00Added an answer on June 10, 2026 at 11:38 am

    you can use sed -i to perform in-place replacement and the regex replace pattern would be:

    s/RELEASE_AND_NIL\((.*?)\)/\[\1 release\]/g
    

    so you can do:

    sed -ie "s/RELEASE_AND_NIL(\(.*\))/[\1 release\]/g" /path/to/your/file
    

    and if you have bunch of source files, you can use find and xargs:

    find . -type f -print0 | xargs -0 sed -ie "s/RELEASE_AND_NIL(\(.*\))/[\1 release\]/g"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone have a good regex for Age verification? I have a date field where
Does anyone have a good (preferably tested) regex for accepting only a valid DNS
Here's an interesting one. Anyone have a good RegEx for converting all (first) ^
Does anyone have a good regex for stripping all symbols (';.,_\$@!% the carriage return
Does anyone use have a good regex library that they like to use? Most
Anyone have good book / article recommendation for procedural generation of background music? (No
I need a excel-like grid control in MFC, do anyone have good suggestion to
Anyone have a good reference for how to do a multivariate ordinary linear regression
I have tried several regex patterns (designed for use with PHP because I couldn't
Anyone want to recommend a good regex tool (Interactive GUI for constructing and learning)

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.