The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleting a line but keeping the same file laiko UNIX for Dummies Questions & Answers 2 05-13-2008 11:08 AM
deleting file content tolkki Shell Programming and Scripting 2 03-19-2008 07:10 AM
Deleting end of line $ character in file bwrynz1 UNIX for Advanced & Expert Users 3 01-08-2008 09:17 AM
Deleting Junks at the end of each line in a file dave_nithis UNIX Desktop for Dummies Questions & Answers 5 10-04-2007 11:51 PM
Deleting end line spaces for along file osymad Shell Programming and Scripting 3 02-23-2005 09:56 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-20-2006
Registered User
 

Join Date: Jun 2006
Location: Las Vegas, NV
Posts: 104
Deleting all content in a file from command line

Hey guys,

I'd like to delete all text within a text file without actually deleting the file. Is there a vi command I can do from my prompt without actually going into the file and doing a %d i think it is... to remove all the text inside?

I want to add this to a cron job to erase all the data in a file at 12non and I can't find anything on how i'd do it the way i'd like

thanks!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-20-2006
reborg's Avatar
Administrator
 
Join Date: Mar 2005
Location: Ireland
Posts: 3,513
Its as simple as
Code:
> file
Reply With Quote
  #3 (permalink)  
Old 07-20-2006
Registered User
 

Join Date: Jun 2006
Location: Las Vegas, NV
Posts: 104
bah i new it was something simple i was ripping my hair out

trying stuff like:

cat blank > testfile

but that was cheesy... thanks a ton!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:03 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0