LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-01-2008, 02:14 AM   #1
ajkannan83
Member
 
Registered: Aug 2005
Location: Tamil Nadu, India
Distribution: Redhat, Fedora
Posts: 120

Rep: Reputation: 15
File content delete


Hello

I have one doubt. I want to delete the content of the file using command.

Any command available in redhat linux.

(Only Delete the content not a file)

Anybody know please reply

Advanced Thanks
A.Kannan
 
Old 07-01-2008, 02:18 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
echo "" > file ?
 
Old 07-01-2008, 02:30 AM   #3
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
If you know the filename, why not just echo "" > filename

oops - sat on that post for a while
 
Old 07-01-2008, 04:10 AM   #4
ajkannan83
Member
 
Registered: Aug 2005
Location: Tamil Nadu, India
Distribution: Redhat, Fedora
Posts: 120

Original Poster
Rep: Reputation: 15
Thank U Very Much
 
Old 07-01-2008, 04:16 AM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
or simply just:

> filename

the shell is the responsible party for setting up the redirection, and in this construct trunctating the file. Of course, if noclobber is set, then you'll need:

>| filename
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
delete file-content ovince Programming 6 04-17-2007 03:44 AM
delete file that match the content packets Programming 5 04-03-2007 02:47 PM
Delete text content syseeker Programming 5 02-07-2006 07:32 AM
delete content form a file bru Programming 1 04-30-2004 07:41 AM
How does one delete directories with content as the SU? Ferrell Ramey Linux - General 2 08-22-2002 07:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration