How to merge lines that start with the same items in a text file
问题 I have a text file containing some thousand lines as follows: File: abc: bla1 bla1 bla1... cde: bla bla bla... ghk: bla1 bla1 bla1... lmn: bla bla bla... abc: bla2 bla2 bla2... bcd: bla bla bla... ghk: bla2 bla2 bla2... xyz: bla bla bla... I want to merge all the lines that start with the same items (as 1 and 5, 3 and 7 ) so that I have a new text file like this: New File: abc: bla1 bla1 bla1... * abc: bla2 bla2 bla2... cde: bla bla bla... ghk: bla1 bla1 bla1... * ghk: bla2 bla2 bla2... lmn: