Find in files – translations texts

Use case

Follow this article if you want to locate multiple occurrences of a string in a folder using a regular expression pattern.

 Find all occurrence of pattern

Using following code in linux command line you will copy all occurrence of the given pattern in a temporary file

Process the found parts

Using a simple text editor compatible with regular expression you will be able to process the temporary file into a wanted format.

See the attached screenshot.

notepad-search-and-replace

In my case I had to find all $this->get(‘Any text here’) in my php files and create a translation file for Opencart platform in the following format: