I can't find a question with an answer that work as i want.
I use to script in bash, but I'm noticing that bash is way too inefficient when it comes to large operations so i'm rewriting my code in python.
But i'm noob in python! So i google a lot but here i have a problem... there are a lot of sed operations in my bash script and i would like to know whats the way to recreate this (and this will be the starting point to rewrite all my sed operations) in python:
sed -i -e "s/\(log_min_messages = \).*/\1notice/" "/opt/PostgreSQL/9.6/data/postgresql.conf"
Which substitute everything after "log_min_messages" in that file with "notice".
Basically that open postgresql.conf file, search for matching pattern "log_min_messages = *" (where * indicates that it doesnt matter what is after '=' ) and replace '*' with the string 'notice'.
Example:
before
log_min_messages = something
after that sed command:
log_min_messages = notice
I wonder if i have to use 're' ?
EDIT: An idea is to implement Perl commands in the python script, so if anyone knows how to do that in perl would be a wonderful answer anyway