echosome content into file, for which we need root permissions. There is a command
teeto help with that. It will display passed string and at the same time write it to file.
Example of trimming log file:
echo "" | sudo tee error.log
To append to a file add
-a parameter to tee:
echo "manual" | sudo tee -a mysql.override