Assume additional records will have different values. Without doing this by hand I've been unable solve it. I tried using a combination of sed, awk, and grep scripts with no success. Any help would be appreciated.
Totally answered my problem. Been working on this for a week. Finished reading the O'Reilly book on bash scripting but could find the answer. It's good but doesn't go into too much detail on sed or awk. Thanks.
awk is its own programming language, it's hard to go over it in detail without it becoming its own book. Not a difficult language mind you, but quite different.
One approach is to make the fields all lines - homogenous if separated, but my standard sed looper is fine for merging lines:
tr ' ' '\12' < in_file | sed '
:loop
$q
N
s/\(....\)\n\1/\1 \1/
t loop
P
s/.*\n//
t loop
' > out_file
But this might mess up for two lines of the same number. In some apps, that might be great; you can put a "| sort" after the "tr" and merge far separated numbers, or a "| sort | uniq -c" and reduce them to a count.
Cheap trick, making all the spaces line feeds and then making them back into spaces where equal. There's a lesson about negative cases there. Mostly, line feed was a certainly not in use substitute character. Once I swapped line feed and form feed so I could sed pages into insert statements (one page per row in one column) and then reversed the fomr feeds back to line feeds. Note that you have to sub twice, for the odd and even spaces. Also, if you know what a string is, you do not have to source the original bytes, any dup quad looks the same!