replace - sed and regex to prepend line -
i'm trying find way search in files , add line before string want search for
xxx = text() // '=' folowed space or not 'text()'
if found :
add before line
new text
in other word want this
xxx = text()
to :
new text xxx = text()
i tried this
find /var/www/users/ \( -name '*.py' \) -type f -exec sed -i 's|\s+\=\s+\text()|new text|i' {} \;
i this, suppose:
find -iname '*.py' -and -type f | xargs sed -i -e '/= *text()/ new text'
Comments
Post a Comment