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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-27-2003, 05:19 PM
|
#1
|
Member
Registered: Feb 2002
Posts: 586
Rep:
|
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
|
|
|
05-27-2003, 05:22 PM
|
#2
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
cat /dev/null > bookmarks.html
|
|
|
05-27-2003, 05:24 PM
|
#3
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Either:
echo -n > YOURFILE
cat /dev/null > YOURFILE
Remember to take backups of important files first!
EDIT: He beat me again!
|
|
|
05-27-2003, 05:29 PM
|
#4
|
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794
Rep: 
|
Well he's a fast addict, and you're a two-method guru 
|
|
|
05-27-2003, 05:34 PM
|
#5
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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 
|
|
|
05-27-2003, 05:50 PM
|
#6
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
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.
|
|
|
05-27-2003, 06:00 PM
|
#7
|
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794
Rep: 
|
If you're fast, could I use you as a brute force cracking tool on this post?
Custom status for +1K posters sounds fun 
|
|
|
05-27-2003, 06:13 PM
|
#8
|
Senior Member
Registered: Dec 2002
Location: Atlantic City, NJ
Distribution: Ubuntu & Arch
Posts: 3,503
Rep:
|
hehe...I couldn't figure that post out myself. I was quick to ask what it was though.
|
|
|
05-27-2003, 06:26 PM
|
#9
|
Senior Member
Registered: Dec 2002
Location: England
Distribution: Used to use Mandrake/Mandriva
Posts: 2,794
Rep: 
|
I gave up
|
|
|
05-28-2003, 06:47 AM
|
#10
|
Member
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 992
Rep:
|
echo " " > file-name
|
|
|
All times are GMT -5. The time now is 05:33 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|