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

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -