This is useful for me when editing my ip ban script. I use the same text file to ban ip´s and sometimes that file is pretty big. A simple method to clear the content of the file without touching the permissions and ownerships. We just copy the dev null device content into the file you want to clear. We do that like this:
cat /dev/null > ip-ads.txt
Now your file ip-ads.txt is empty.
Happy clearing.