5

Script to insert line into files in sub-dirs

view full story
linux-howto

http://unix.stackexchange.com – I have a sub-dir tree with varying number of branches and most of the branches contain .cpp files (many of them). I have a header-file at the root of the tree that I want to have as a #include "<constructed-relative-path-to-root>/headerfile.h" as the first line of each .cpp. an alternative to constructed-relative-path-to-root would be the hard-coded path, which would have to be adjusted whenever the project is relocated) a second alternative would be to copy the content of the header-file in at the top of each .cpp file I have no idea how to write such a script. Can anyone please he (HowTos)