How to empty (truncate) the file without deleting the file
I would recommend to delete and recreate a fresh file since truncating the file is not a good idea. If you want to truncate then try this,
cat /dev/null > file_name
/dev/null is an empty file which is present in all the machines. Here I used cat command to amend that empty file to the filename. So the content of the file will get truncated. cheers...