我有一个带有以下几行的文件
key1=value1 AND key2=value2 followed by some other text
key3 {value3} some text key4 - value4 and key5 - value5
是否可以提取值1,3、4和5并打印?请注意,仅在连续两行都包含所有匹配项的情况下考虑匹配项。如果可以轻松完成,我就会知道我要寻找的键。
输出(或类似的东西)
key1 = value1,key3=value3,key4 = value4,key5 = value5
示例1-
abc = 12ty3 AND jfk = 345 followed by some other text
klm {678er} some text plr - 567 and deg - 345
输出
abc = 12ty3,klm = 678er,plr = 567,deg = 345
示例2-
xyz-232 abc = 126y3 AND jfk = 567 followed by some other text dre {567x}
klm {rtyyr} some text plr - 444 and deg - 555 some text 345 = uut
输出
abc = 126y3,klm = rtyyr,plr = 444,deg = 555