This is the formatting done for this ubuntu command egrep -v "usernameshere" in python as bellow
userfilter = ["egrep", "-v", "\"{filter}\"".format(filter=filteruser)]
Why doing: I am passing this to a subprocess and executing the command from python.
Now I want to accomplish the same for this command how to do it.
awk '{gsub("admin","");print}'
I tried the below one but not working, some syntax errors
Try 1
userfilter=["awk","\'{gsub({filter},\"\");print}\'".format(filter=filteruser)]
Try 2
userfilter=["awk","\'{gsub({filter}.format(filter=filteruser),\"\");print}\'"]
Errors:
TRY 1 Error:
userfilter=["awk","\'{gsub({filter},\"\");print}\'".format(filter=filteruser)] KeyError: 'gsub({filter},"");print'
TRY 2 Error:
awk: 1: unexpected character '.'
awk: line 1: extra ')'