How do I clear the contents of a file before writing to it? For example:
echo one > filename.tmp
# filename.tmp now contains "one"
echo two > filename.tmp
# filename.tmp should now contain "two", not "one" and "two"
My goal is:
Start a listener
$ nc -l 7007 > /var/tmp/test.logSend some data
$ telnet localhost 7007 hi second_wordTest the file
$ cat /var/tmp/test.log second_word
I don't want "hi" to show up in the log; I want "second_word" to have replaced it
