LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-27-2003, 05:19 PM   #1
mikeshn
Member
 
Registered: Feb 2002
Distribution: Fedora Core 2
Posts: 586

Rep: Reputation: 30
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
 
Old 05-27-2003, 05:22 PM   #2
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
cat /dev/null > bookmarks.html
 
Old 05-27-2003, 05:24 PM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Either:
echo -n > YOURFILE
cat /dev/null > YOURFILE

Remember to take backups of important files first!

EDIT: He beat me again!
 
Old 05-27-2003, 05:29 PM   #4
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
Well he's a fast addict, and you're a two-method guru
 
Old 05-27-2003, 05:34 PM   #5
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
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
 
Old 05-27-2003, 05:50 PM   #6
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
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.
 
Old 05-27-2003, 06:00 PM   #7
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
If you're fast, could I use you as a brute force cracking tool on this post?

Custom status for +1K posters sounds fun
 
Old 05-27-2003, 06:13 PM   #8
Crashed_Again
Senior Member
 
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503

Rep: Reputation: 57
hehe...I couldn't figure that post out myself. I was quick to ask what it was though.
 
Old 05-27-2003, 06:26 PM   #9
Proud
Senior Member
 
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794

Rep: Reputation: 116Reputation: 116
I gave up
 
Old 05-28-2003, 06:47 AM   #10
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 991

Rep: Reputation: 30
echo " " > file-name
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cutting down contents of text file kam_kenneth Linux - Newbie 2 05-22-2004 01:16 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM
tar from contents of a text file trpn Linux - General 3 03-08-2004 01:05 AM
showing contents of a tar.Z file jpostma Linux - General 1 11-12-2003 05:14 AM
List the contents of a directory to a file MasterC Linux - General 19 11-26-2002 10:09 AM


All times are GMT -5. The time now is 01:23 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration