How can I delete the content of a file using getline. The file should be refreshed in every 9th loop and the old content until the last 9th loop then it should be deleted so that the new content can be written and retrieved again..
Script Function:
function leeren(tmpdatei){
while(getline line < tmpdatei){
line=""
}
}
This the function which is supposed to delete the content of a file. The function is called on every 9th loop. Logically it is okay in this sense, but the deleting the content is not working, I guess, deleting the content of a file with getline is not the correct way, right?
How can I then delete the content of a file at a time or in a loop?
To delete a file from within
awkyou could use redirection:Edit
As Kent noted, the file needs to be closed to make this work properly. The following modification should be enough: