Quote:
Originally Posted by Turbocapitalist
(Post 5722871)
I'd say wpeckham's advice about figuring out the workflow is important. But unfortunately that workflow is somewhat dependent on the tool(s) used. Thus you have a bit of a circular dependency. To break that, I'd nudge you in the direction of awk or perl, mainly the former. I see a way to do it with two instructions with awk -- if the date field is always first in each block.
Regardless of which tools you start with, please post what you have begun so we can see the direction you are taking and can offer advice.
|
The concepts of planning I offered do not derive from the workflow, indeed may help DETERMINE the workflow. They depend upon analysis of the DATA flow as derived from the statement of the problem, data input, desired transformations, and data output, and not at all on the tools used. There is no circular dependency. I see why you think there may be, but you if you consider it as a programming problem there is none.
BASH can do this, PERL is almost DESIGNED to do this (and most things, it is one of the most versatile tools), or you can do this in python, Pascal, c, assembler, BASIC, FORTRAN, COBOL ... : the list is almost endless.
The OP needs to consider what he WANTS to use (BASH is an expressed preference, see the title of the thread) so we can assume that over awk, perl, sed, etc.
Bash can, using only internal commands and shell features, read files, compare and use strings, create files and folders, all of the critical pieces are there for this problem without calling awk, sed, grep, perl, or other external tools. He may, on consieration, wish to use one or more external tools as a 'helper' for his script, but it can be done without those.
.