Hello,

We are using SOM9331 module and we need to receive the data over uart. We have disabled the Kernel message, the necessary packages for serial port are installed.

We are able to receive the data in /dev/ttyATH0, the data received need to be saved in text file. The data saved in text file will be used to display on web pages which we have developed.

Can anyone let me know how we can save the UART data to text file. We used CAT command but there are 2 issues, 1. Data is getting appended where as we need the data to be overwritten. 
2. Using CAT command, the file is not getting closed, even if we add CTRL+Z at the end of script.

The script needs to be continuously running as the data may come any time. 

Thanks,
Sreekanth