So I'm looking how I can put together a Bash script that can give prompts to a use for mass changing strings and variables in files in files and apply changes to all files that have that string or variable to a new one.
Case in point for example I had a bunch of files that have a string with a number value in it, and I want to change it to a new value, ie;
font-size=30
and let's say I want to change 30 to a different number value of 25. I know this can be achievable by doing;
find . -type f -exec sed -i 's/font-size=30/font-size=25/g' {} \;
but if I wanted it to be intractable to let the user change to any value by typing it in themselves in the bash prompt, like so, ie;
Search and replace all font values of %n
Font size Value = 30
Enter new value:
How would I be able to do this as an intractable prompt that asks for a user's input? So not only just being able to search and replace all instances of values belonging to Font-size= but searching and replacing other values such as x and y position values also.
All I'm basically looking to do is making a prompt menu where you have to select from the menu what you want to do, and then do as I've described above. Give it an input file, or a directory containing a bunch of files, take the following for example;
Choose from menu [1-3]:
1 - Replace Font-size values
2 - Replace X and Y values
3 - Exit
- - -
Select file or directory target: <user_input_here>