Sometimes, user-friendliness or rules from above(/before you were there) do not allow you to do what you want. I need to have the output file as option on the command line. Most users do not want to bother with shell stuff and some are very inexperienced... -> My achievable elegance is drastically limited/controlled... ;-(
Re^2: Append to file or create file depending on input filename.
Replies are listed 'Best First'.
That is, use "-a" instead of an angle bracket. Or better yet (assuming that it's more important to avoid deleting existing data), make appending the default mode of operation, and have an option "-n" (for "new") or "-b" (for "begin" or "blank-slate") or whatever, to create/truncate the output file.
Rest assured, the OP design is the farthest thing from "user friendly". You have to do better than that.