![]() |
|
|
|
|
|||||||
| 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 |
| Removing empty folders using 'find' | deTTo | UNIX for Dummies Questions & Answers | 5 | 04-21-2008 06:24 PM |
| Removing empty folders using the "find" command | biot | UNIX for Dummies Questions & Answers | 3 | 03-25-2008 07:43 PM |
| File is not empty? | lesstjm | Shell Programming and Scripting | 7 | 07-12-2007 07:21 AM |
| Removing empty spaces and adding commas | jazz | High Level Programming | 4 | 11-13-2006 06:54 AM |
| empty file in hp-ux | Mizi | UNIX for Advanced & Expert Users | 2 | 08-09-2006 03:29 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to empty a file without removing it.
I used to be able to do the following command on HP while largefile was being written to.
> echo " " > largefile When I try the same on Solaris I get a message that the file already exists. Is there a parameter that I need to setup in my env ? Thanks in advance Last edited by jxh461; 05-30-2007 at 06:12 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Jxh461,
There is an option in the "set" command that controls the truncation of files. The following does not allow files to be truncated: Code:
set -o noclobber |
|
#3
|
|||
|
|||
|
Thanks for that info Shell. However, I am not sure if that is the cause of my problem. In any case how would I unset it if it were ?
|
|
#4
|
|||
|
|||
|
try this
>largefile
|
|
#5
|
||||
|
||||
|
Code:
echo '' >| largefile # OR more simply >| largefile |
|
#6
|
|||
|
|||
|
cat /dev/null > largefile
|
|
#7
|
|||
|
|||
|
set +o noclobber.
Then any of the above commands will work. |
|||
| Google The UNIX and Linux Forums |