Issue
I want to get rid of a line from a python file which is not starting with def
.
thefile.py
has
def showBuilder():
""" Do something
And build show
"""
showBuilder()
Now I want to leave the line def showBuilder as is but want to get rid of the line showbuilder() at the bottom
I tried
sed '/^def / s/showBuilder()//' thefile.py
but this is returning
def :
""" Do something
And build show
"""
showBuilder()
would love to use anything that works, sed is just my try.
Solution
So match the line and the delete it.
sed '/^showBuilder()$/d'
You might find simpler to just:
grep -vxF 'showBuilder()'
Answered By - KamilCuk Answer Checked By - Candace Johnson (WPSolving Volunteer)