I want to modify every file in a directory recursively.I want to replace: <?phpwith <?php /**  *  * Copyright (C) MyCompany, Ltd. - All Rights Reserved  * Unauthorized copying of this file, via any medium is strictly prohibited  * Proprietary and Confidential  * Written by Justin E <justin@domain.tld>, March 2014  *  */What would be the best solution? I know some sed, but I am looking to keep the spacing and newlines as well so that it looks professional.
Find and Replace Recursive
shell script;text processing
I would create a file as dummy with the contents that you want to be replaced. So dummy file would look like below. <?php /**  *  * Copyright (C) MyCompany, Ltd. - All Rights Reserved  * Unauthorized copying of this file, via any medium is strictly prohibited  * Proprietary and Confidential  * Written by Justin E <justin@domain.tld>, March 2014  *  */After that, I would execute the below script. for f in ./*; dosed -i '/<?php/{    s/<?php//g    r dummy}' $fdoneI am replacing the <?php with spaces and replacing it with the contents from the dummy file. 