我在文本文件中有這種形式的數據。如何將文本文件中的第一行添加到以下行中,直到滿足條件,然後重複?
UB25X
0060 16年4月22日-20.19
0060 15年3月17日-23.37
* UB25X
FJ39Y
0060 16年1月15日-27.34
0060 7/15/16 -23.10
* FJ39Y
我想打印輸出:
UB25X 0060 16年4月22日-20.19
UB25X 0060 15年3月17日-23.37
FJ39Y 0060 1/15/16 -27.34
FJ39Y 0060 7/15/16 -23.10
,幾乎都有,但前綴後的第一個沒有改變。第4行的前綴應改爲FJ39Y – Shawn
UB25X變速箱0060 4/22/16 -20.19 – Shawn
確實將第一行添加到所有以下行的前面,但添加的行應在產品更改時更改。第一行是庫存項目[NAME]的名稱,以下行是庫存交易,直到具有[* NAME]的記錄爲止。 – Shawn