I'm having a bit of trouble with sed at the moment. I am quite sure it is because I am a dumbass and have forgotten how to handle my quotes and regular expressions.
Basically, I am wanting to use sed in a script to replace a line defining a mysql database password. In theory it should be working, here is how I have been testing it (I just cat the file and pipe it to sed, which should then display the substituted line:
That, I would imagine, is what it should look like, but it just doesn't work
I think the single quotes are causing all the hassle. I tried surrounding it with double quotes (""), but that pretty much achieved nothing. I have also tried using backslashes to define the single quotes within the string. Also no luck.
If anyone has any thoughts, suggestions or another way to do this, please help me before I go insane and kill someone.
Basically, I am wanting to use sed in a script to replace a line defining a mysql database password. In theory it should be working, here is how I have been testing it (I just cat the file and pipe it to sed, which should then display the substituted line:
Code:
cat /home/kasyx/mysqldb.txt | sed 's/my($db_pass) = '';/my($db_pass) - 'password';'
That, I would imagine, is what it should look like, but it just doesn't work
If anyone has any thoughts, suggestions or another way to do this, please help me before I go insane and kill someone.