Hi ,
I have a file with data like
FamilyP:
: ChildD
: ChildC
: ChildA
FamilyD:
: ChildC
: ChildB
FamilyA:
: ChildP
: ChildB
Is there a way in which I could sort the data so that it is sorted by family and children. I tried the sort command but there is no way to say sort the first column and within that sort the second column . The o/p I need is as below...
FamilyA:
: ChildB
: ChildP
FamilyD:
: ChildB
: ChildC
FamilyP:
: ChildA
: ChildC
: ChildD
Any help much appreciated. If this cannot be done by shell scripting, can this be done using AWK ?
Thanks.
I have a file with data like
FamilyP:
: ChildD
: ChildC
: ChildA
FamilyD:
: ChildC
: ChildB
FamilyA:
: ChildP
: ChildB
Is there a way in which I could sort the data so that it is sorted by family and children. I tried the sort command but there is no way to say sort the first column and within that sort the second column . The o/p I need is as below...
FamilyA:
: ChildB
: ChildP
FamilyD:
: ChildB
: ChildC
FamilyP:
: ChildA
: ChildC
: ChildD
Any help much appreciated. If this cannot be done by shell scripting, can this be done using AWK ?
Thanks.