On Wed, Aug 14, 2002 at 07:33:49PM +0530, Hareesh Haridas wrote:
> is there a method/command in linux to empty the contents of a file
> without deleting it ? i mean something which does the equivalent of: 

I keep this around:

binand@binand[~]:(5) type empty
empty is a function
empty ()
{
    for i in $*;
    do
        if test -f $i; then
            cp -f /dev/null $i;
        fi;
    done
}

Put the function in your .profile, and use it as:

empty file1 file2 file3 ...

Binand

-- 
If you found this helpful, please take some time off to rate it:
http://svcs.affero.net/rm.php?r=binand


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to