I am a little new to all this but have been playing around.
I have a CPANEL Server and need to add some text to a specific file. Its 2 x lines of text and needs to be added to the start of the file.
I have managed to do this with the sed -i method but two things i cant do ;
- Add it to the start and not replacing something
- I actually need to scan the main directory, sub directories and sub sub directories for many files all the same name. Then i need to add it to each of these files. Each folder (there is about 100) has the same file i need editing in, and some sub sub folders also have it.
So to clarify, if anyone can help ;
- I need to add 2 x lines of text to the start of a file 'thisfile.txt'
- I need to add a space under this inserted text, before the original text continues
- There is multiple files in many places in many directories. I need to target them all in the same way.
- There is Sub directories and sub sub directories
- I am using a Cpanel server with terminal
Thanks in advance. Looking forward to help and playing around with this.
Apologies for quite a few tags. Not 100% sure who to be aiming at. Im new here.
question from:
https://stackoverflow.com/questions/65869568/cpanel-terminal-add-2-x-lines-of-text-at-start-of-a-document 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…