Save the script I wrote in a file, turn it executable and execute it in a terminal. Without any argument, it asks the kernel to write the buffered data to disk every five second (you can change this default editing the number 5 at the beginning of the script). With one argument, you can specify a different period. It must be a valid argument to 'sleep': 2 or 2s for two seconds, 5m for five minutes, etc. Any number of files can be given as additional arguments: if so, only those files will be sync'ed.

Your "thoughtful guess" makes little sense: no data flows in the first pipe, all your '-' are useless (most commands process the standard input by default; also, the quotes are here useless), the sed substitution writes parentheses that tr removed immediately after, the second awk prints $3 that does not exist (the first awk only kept two fields) and, as I have already told you many many times (the last time was one week ago: https://trisquel.info/forum/another-uniq-u-feature-emerges#comment-150310), sort -k 1 is the same as sort alone (you probably want sort -k 1,1).

followed by sync's responses

sync does not write anything (but errors).  time outputs what you show.

without any actual conclusion of the script; the prompt hasn't reappeared yet, even though there is no network activity. I used Ctrl+C to regain the prompt.

The while loop is infinite. That is why I told you "Type Ctrl+C to terminate" in https://trisquel.info/forum/how-can-awk-substitute-paste#comment-150532

Where was sync saving the cached output during the 4-1/4 hours the script was running ?

Please read https://trisquel.info/forum/how-can-awk-substitute-paste#comment-150543 again. I suspect you do not understand the concept of a data buffer. Without such a buffer, whenever something is to be written in a file, it would be directly written onto the disk. Nevertheless, writing many times small amounts of data onto the disk is slow. It is more efficient to accumulate in RAM the data and to make one big write when a lot was accumulated or when necessary. sync tells the kernel (which manages the buffer) "it is necessary".

Reply via email to