|
Home > Archive > Sun Solaris > November 2002 > empty/delete contents of file
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
empty/delete contents of file
|
|
| supercat 2002-11-01, 6:23 pm |
| How can I empty/delete the contents of a file, without deleteing and recreating the file with permissions/user/group attributes.
# ls -al
total 63960
-rw-r--r-- 1 nobody bin 32331689 Nov 1 18:52 access_log
For example I want to empty the contents of the access_log file.
Thanks | |
| unixnation 2002-11-04, 4:44 pm |
| # cat /dev/null > access_log | |
| Grasshopper 2002-11-06, 10:05 pm |
| echo > access_log
works too.
Grasshopper | |
| supercat 2002-11-07, 1:40 pm |
| Just after I posted this question, I found the answer in a shell programming book.
Thanks, Unixnation and Grasshopper for answering my question... | |
| drdirt 2002-11-15, 7:19 pm |
| quote: Originally posted by supercat
Just after I posted this question, I found the answer in a shell programming book.
LOL, I've done that a few times! Thought I ran out of ways to find it, posted a Q, then ran into the answer. Felt like I was being an extreme lamer...
No worries, I benefitted from this answer. Maybe a couple more did. |
|
|
|
|