I work on a mac OSX 10 +.
I an looking for some software that can enable me to change a word of text in a file ( php file or otherwise ) without having to open each file individually.
Let me explain - I have a folder named 'code folder' and it contains 72 php files, I want to remove specific word from all the 72 php files without having to open every file and scan through them individually and find and replace the word I am looking for.
Does anyone know of any software for the Mac that will enable me to do this, or if not how it could be do otherwise.
Many thanks in advance for any help you may be able to me.

Recommended Answers

All 3 Replies

try using grep command in a directory

grep -R 'yoursearchword' *

Use gawk or sed to replace the word where you find.

Hi

Many thanks for your reply - I am a novice at this kind of ting but am keen to learn - not sure how to implement this command - can I do it locally on OSx via terminal and how do I constrain the search to a folder only, even if the folder i have the files in has subfolders that need searching also?

If I had a folder named 'PHP' on my desktop that had many files and subfolders in it also with files inside the subfolders, and I needed to scan all the files in my 'PHP' folder including the files in the subfolders, how would I code that terminal command to find and print the occurrences of the word I am searching for in all of the files?

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.