I created the following sed
in order to add the python command – exit()
before the line LIST_ALL_SELECT_TOOL_PACKAGES_CMD
in the file – yumrpm.py
sed -i '0,/LIST_ALL_SELECT_TOOL_PACKAGES_CMD/s//exit()n&/' yumrpm.py
Example ( after we run the above sed syntax )
exit()
LIST_ALL_SELECT_TOOL_PACKAGES_CMD = "yum list all"
The problem is when we run the sed
again and in this case we get addition exit()
example:
exit()
exit()
LIST_ALL_SELECT_TOOL_PACKAGES_CMD = "yum list all"
What need to add in sed
syntax command , in order to avoid adding of exit()
when exit()
already exists before the line LIST_ALL_SELECT_TOOL_PACKAGES_CMD
?