Answer the question
In order to leave comments, you need to log in
Why does awk erase part of a file?
I want to change the text according to the regular expression in the files
I write the following:
ag -rl regexp | xargs awk "{gsub(/regexp/, \"string\"); print > FILENAME}"
Answer the question
In order to leave comments, you need to log in
Alas, I could not figure out how to fix it, but I found an alternative (sed came to the rescue)
the -i switch indicates in-place replacement and overwrites the file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question