I need to make a bash script that reads a file containing variable = text. What I need is for the script to check the file, ignore the variable name and search for a word in the text after the = symbol.
Example
thread.give_respect.title = Give respect
thread.receive_respect.title = Gain respect
thread.profile_respect.title = Show my Respect
As the first part is variable I don't want the word respect to be changed. Only the one after the = Also if possible I want to make a check if the word I want to change is with Capital or not so that I can change it accordingly.
Edit:
Esteban I tried your script but it creates the file with ${var at the beginning of each line.
For the other guys that are asking what I want to replace so:
We have huge files with string variables = their text. For example:
admin.help_text = help
admin.Help_text = Help
home.faq_title = FAQ
...
These files contain more then 15000 variables and their values. Sometimes we need to change a word to different one for example:
**help** to **guidance**
**Help** to **Guidance**
**helper** to **guide**
**Helper** to **Guide**
What we need:
Script that checks a file for: word1, word2, word3 and word4.
If word exist on line to copy that line into a separate file.
After everything is done to run find and replace for word1, word2 and etc. on the new file.
For example we have file (file1.txt) with all the variables and their content:
admin.help_text = help
admin.Help_text = Help
home.faq_title = FAQ
home.something.help = If you need help please send us email on...
When script start it will check for:
word1 = help
word2 = Help
And saves the lines that it found into file2.txt
admin.help_text = help
admin.Help_text = Help
home.something.help = If you need help please send us email on...
Then the script checks file2.txt and changes help to guidance and Help to Guidance
admin.help_text = guidance
admin.Help_text = Guidance
home.something.help = If you need guidance please send us email on...