Awk newbie:
My input file gathers data as a list:
timestamp1
type1 a
type1 b
type1 c
type2 d
type2 e
type4 g
type5 h
type5 i
type5 j
type5 k
type5 l
timestamp2
type2 d
type2 e
type3 a
type3 b
type3 c
type4 g
type5 h
type5 i
type5 j
type5 k
type5 l
timestamp3
type2 d
type2 e
type3 a
type3 b
type3 c
type4 g
type4 h
type4 i
type6 j
type6 k
type6 l
I need to reformat as a table:
timestamp1 type1 a b c
timestamp1 type2 d e
timestamp1 type3
timestamp1 type4 g
timestamp1 type5 h i j k l
timestamp1 type6
timestamp2 type1
timestamp2 type2 d e
timestamp2 type3 a b c
timestamp2 type4 g
timestamp2 type5 h i j k l
timestamp2 type6
timestamp3 type1
timestamp3 type2 d e
timestamp3 type3 a b c
timestamp3 type4 g h i
timestamp3 type5
timestamp3 type6 j k l
There is a defined range of types. The number of entries for each type varies in each time interval. Timestamp does not follow a regular interval.
My input file gathers data as a list:
timestamp1
type1 a
type1 b
type1 c
type2 d
type2 e
type4 g
type5 h
type5 i
type5 j
type5 k
type5 l
timestamp2
type2 d
type2 e
type3 a
type3 b
type3 c
type4 g
type5 h
type5 i
type5 j
type5 k
type5 l
timestamp3
type2 d
type2 e
type3 a
type3 b
type3 c
type4 g
type4 h
type4 i
type6 j
type6 k
type6 l
I need to reformat as a table:
timestamp1 type1 a b c
timestamp1 type2 d e
timestamp1 type3
timestamp1 type4 g
timestamp1 type5 h i j k l
timestamp1 type6
timestamp2 type1
timestamp2 type2 d e
timestamp2 type3 a b c
timestamp2 type4 g
timestamp2 type5 h i j k l
timestamp2 type6
timestamp3 type1
timestamp3 type2 d e
timestamp3 type3 a b c
timestamp3 type4 g h i
timestamp3 type5
timestamp3 type6 j k l
There is a defined range of types. The number of entries for each type varies in each time interval. Timestamp does not follow a regular interval.