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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -