I am a beginner in bash and have been trying to solve one annoying problem - I cannot add text to a MS Word (.doc
) file.
I managed to extract text but not insert one. I tried using sed
command but it ruins the file - I suppose because it adds the text to the file's 'source code' (not sure if that is the correct term). I also tried adding text to an .html
file (using the same commands) and it still doesn't work. It only works with a simple .txt file.
Commands I have tried:
$: sed -i 'a/existingTest/newText' MyFile.doc
OR
$: sed "/existingText/a newText" MyFile.doc
# I use "existingTest" to identify the location where I want to append my newText.
With both commands the text is added (whether it is applied on a .doc or .html file) inside the 'source code' which makes the file unreadable.
Does anyone knows a way to add text to a .doc or an .html file? Preferably a soulution that a beginner will understand but I will welcome anything :D
Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…