![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| 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 !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to delete content in a file (delete content only) | kittusri9 | Shell Programming and Scripting | 5 | 05-15-2008 10:12 AM |
| extract content from a file and insert to another file | fredao | Shell Programming and Scripting | 15 | 12-06-2006 04:36 PM |
| Using the content of a file in the name of another | anriot | Shell Programming and Scripting | 2 | 09-18-2006 04:56 PM |
| transfer of specific file content to another file | mem101 | Shell Programming and Scripting | 1 | 10-18-2005 11:01 AM |
| I need to delete the content out of a number of logs | Jbolin01 | Shell Programming and Scripting | 4 | 09-30-2003 06:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
I want to delete the content of some files,which are specified through wild-card option,but i want to restore the file. I.e I just want to delete the contents file parameters shouldn't be changed. [Touch is not my answer]. Please provide me the answer. Thaning u all in advance Athresh |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
echo "" >> filename
will empty the contents of the file |
|
#3
|
||||
|
||||
|
You can also just do...
> filename ...which truncates an existing file or creates a new "empty" file |
|
#4
|
|||
|
|||
|
This won't work so well for multiple truncations....
$ > 11* bash: 11*: ambiguous redirect Is provided when using any of the methods mentioned above. I think the redirection needs specific filename as it can be used to change create new files too..... May not be as easy as above..... definitely would be a way with a for loop - however surely there is an easier way????? And I'm not even gonna try the for loop for you as I'm more likely to win a grammy than get it working...
__________________
Pete |
|
#5
|
||||
|
||||
|
for fname in *.?xt
do > $fname done |
||||
| Google The UNIX and Linux Forums |