I’m having an input file with one million records and formatting and writing to another file to a different location but some times it is writing empty file(intermittent). Following is the scenario: Input.out
Hi Neo, Thanks for the information, however I doubt it is timing issue, as trailer record consists record count from input records and every time we had this issue, trailer record is the only record written to the output with correct record count. Thanks
See remark about : instead of ; (I assume it's just wrongly formatted post, and you don't need any of them, but if you really do need it - always use ; at the end of each complete command).
And you don't actually need cat for anything
Make sure the last command (for writing trailer data) always uses >> to append and NOT a single > to overwrite. If not sure, in Bash you may use e.g. set -o noclobber that prevents > from overwriting an existing file, while still allowing >> to append to it.