LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Delete contents of the file, but not file? (http://www.linuxquestions.org/questions/linux-general-1/delete-contents-of-the-file-but-not-file-62156/)

mikeshn 05-27-2003 06:19 PM

Delete contents of the file, but not file?
 
I'm interesting what command allows to do the following:

to delete contents of the file but not a file itlself.

For example: Mozilla has a file bookmarks.html (with a lot of links) and I want to delete the links but not the file.

How can I do this ?

Thanks

Crashed_Again 05-27-2003 06:22 PM

cat /dev/null > bookmarks.html

david_ross 05-27-2003 06:24 PM

Either:
echo -n > YOURFILE
cat /dev/null > YOURFILE

Remember to take backups of important files first!

EDIT: He beat me again!

Proud 05-27-2003 06:29 PM

Well he's a fast addict, and you're a two-method guru ;)

david_ross 05-27-2003 06:34 PM

Quote:

Originally posted by Proud
Well he's a fast addict, and you're a two-method guru ;)
lol

We once spent a whole day doing that - I thought
Crashed_Again was going to sue me for harrasment :p

Crashed_Again 05-27-2003 06:50 PM

hehe...what I lack in knowlege I make up for in speed. Could I possible change my status to 'Fastest Answerer In The West'?

david_ross, I'm filing the harassment papers now.

Proud 05-27-2003 07:00 PM

If you're fast, could I use you as a brute force cracking tool on this post? ;)

Custom status for +1K posters sounds fun :)

Crashed_Again 05-27-2003 07:13 PM

hehe...I couldn't figure that post out myself. I was quick to ask what it was though.

Proud 05-27-2003 07:26 PM

I gave up

jayakrishnan 05-28-2003 07:47 AM

echo " " > file-name


All times are GMT -5. The time now is 10:56 AM.