Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove file question

Status
Not open for further replies.

stu78

Programmer
May 29, 2002
121
GB
Hi,

To remove a file from within an awk script; can I use

cp /dev/null "file_to_rm.txt"

or

rm "file_to_rm.txt"

is there a better method to do this?
 
Stu:

you can use the system command to execute an external unix command. Myself, I think it's cleaner to remove files outside the awk script, but that's a personal choice.

cp /dev/null "file_to_rm" isn't really a delete, but it truncates the file to 0 size.

Regards,

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top