A
A
alienstone2016-04-24 10:47:02
linux
alienstone, 2016-04-24 10:47:02

How to overwrite files received by find command?

Hello
In general, I encountered the following problem.
With the find command, I get all the files I need, which are then sent to myscript, processed there, and the processed data is sent to stdout. But now there is a need to just take and rewrite the file (replace with processed output) and I can't imagine how elegantly this can be done.
find. -name *.cpp gives a list of all .cpp files that I need to process.
The vera++ program receives one of the .cpp files as input and for each generates its transformation to stdout
. Now I need to overwrite the original .cpp file with this output.
Here's what I have at the moment:

find $INCFINDOPTS -name *.cpp  | xargs -n 1 vera++ -r . --profile codechecker_transform

Help please
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2016-04-24
@alienstone

find . -name *.cpp -exec myscript {} > {}.new \;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question