erase file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers erase file
# 1  
Old 03-10-2005
erase file

I have a file that always generated in the system eg. /tmp/log.txt , it is generated by the application program , but this file should not be present in the system otherwise there are some program problem , I want to erase this file once the program has generate it , as I know , it can link to /dev/null , could suggest how to make it


I use the s.link function , it is OK to link the file , but the /tmp/log.txt is exist , even the file can't be update but I really don't want the file exist in the system , how can I make the file don't appear in the system ( even the file size is 0 ) ? thx


/tmp/log.txt -- > /dev/null
# 2  
Old 03-10-2005
As you stated, link it to /dev/null if you don't want it. Instead of having the real file, it will be a link to /dev/null. Use a startup script to insure it's a link while booting (and have the script create it if it isn't there.) before the application starts. Realize that some testing may be needed as the application may not like the fact that it's a link.

I also wonder why, if this file is a sign of a program error, why you want to get rid of it - instead of fixing it so the file is a link to /dev/null, fix the program!
# 3  
Old 03-10-2005
You can also truncate a file to size zero

Depending on your shell
Code:
> filename
# or
cat /dev/null > filename

And RTM has it - why not fix the program?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Can't erase/move/copy file!

Hey everyone!. I have a problem with a file that doesn't allow any operation on it. I can't rm,mv,cp nor any other operation to it, I get the following errors: bash-2.05# mv ora_2527.aud /bkp mv: cannot access ora_2527.aud bash-2.05# cp ora_2527.aud /bkp cp: cannot access ora_2527.aud... (4 Replies)
Discussion started by: dragonov7
4 Replies

2. UNIX for Dummies Questions & Answers

Erase line of text file one by one

Hi, I have a BASH script where I would like to identify all the lines of a text file that match specific pattern, and then erase them one by one. The ultimate goal will be to identify all the lines matching the pattern, and then for each line identified prompt the user whether or not to erase... (3 Replies)
Discussion started by: msb65
3 Replies

3. AIX

Erase hard disk

Hi ... How to erase bootable hard disk in Pseries... (3 Replies)
Discussion started by: sumathi.k
3 Replies

4. UNIX for Dummies Questions & Answers

Erase an at job

Hello everybody i need to erase a at job that i write. I wrote at 22 at>execute a command at>Ctr + d How do i erase this? I don`t wan`t to do this. I need to change something when i pressed ctrl + d give a job number (2 Replies)
Discussion started by: enkei17
2 Replies

5. Programming

Find pattern in a file and erase it

Hello, I'd like to find pattern in a file and erase line containing that pattern and 2 lines below that pattern. I know how to find pattern with grep -r pattern and erase line containing that pattern, but can't figure out the rest, how to erase 2 lines below that pattern line. Any suggestions? ... (4 Replies)
Discussion started by: c0mrade
4 Replies

6. UNIX for Advanced & Expert Users

stty erase r

after hitting this command...on pressing r acts as a backspace character.... how to disable this function (5 Replies)
Discussion started by: bishweshwar
5 Replies

7. UNIX for Advanced & Expert Users

stty erase in a script

does anyone know how to incorporate this in a script so users can actually make use of their backspace button that they've grown accustomed to? stty erase ^H --- this isn't working the script. works on command line but i wanna invoke it whenever this program of mine is run so users can use... (2 Replies)
Discussion started by: Terrible
2 Replies

8. UNIX for Dummies Questions & Answers

erase and interrupt keys

This is on our Ultra 5/10 Sparc with Solaris 9. I need to store the following (stty) keys in the .profile and /etc/profile files as shown here. erase "Back Space Key" Interrupt "Ctrl + C" I need the exact syntax/procudure as I have to set these two keys whenever I login to the terminal... (1 Reply)
Discussion started by: chrs0302
1 Replies

9. UNIX for Dummies Questions & Answers

stty erase e command

I'm not familiar with the stty command. What would "stty erase e" do to my system and what kind of problems would it create? Also, how would I undo this command? (1 Reply)
Discussion started by: CEngel0327
1 Replies

10. Shell Programming and Scripting

Erase files and directory

I have a set of files created under different name, but they all have the same directory name at some point. I will like to delete all the files and directories after the common name: Here is an example: techs\fins\results\oaks\bigs tech2\gihs\results\gears\picks ... (3 Replies)
Discussion started by: odogbolu98
3 Replies
Login or Register to Ask a Question