0
Process1 |5f|03/29/13 15:32:59
Process1 |6f|03/29/13 17:59:03
Pro cess1 |s7|03/29/13 17:59:05
Pro cess1 |1234|03/29/13 20:33:43
Pro cess1 |L|03/29/13 20:33:54
A Pro cess |45g|03/29/13 20:34:59
A Pro cess |f4|03/29/13 21:10:22
B Pro cess |Es|03/30/13 00:11:25
B Pro cess |23|03/30/13 00:47:20
B Pro cess |E23|03/30/13 01:03:07
預期輸出:
Process1 |5f|03/29/13 15:32:59
|6f|03/29/13 17:59:03
Pro cess1|s7|03/29/13 17:59:05
|1234|03/29/13 20:33:43
|L|03/29/13 20:33:54
A Pro cess |45g|03/29/13 20:34:59
|f4|03/29/13 21:10:22
B Pro cess |Es|03/30/13 00:11:25
|23|03/30/13 00:47:20
|E23|03/30/13 01:03:07
邏輯:離開第一列的只有一個實例和替換其他空白實例
我試過了,bu牛逼沒有工作(以下面的代碼迴路):
sed -e 's/Process1/ /g' -e 's/ /Process1/1' Input
(替換爲處理1「 - 」,然後替換的第一個實例 - 再次與處理1'。
如由 「cnicutar」 給定的,我修改了AWK爲:
AWK -F 「|」 「{A [$ 1] ++;如果(a [$ 1]> 1)$ 1 =「」;打印;}」從ABV文件
輸出:
Process1 |5f|03/29/13 15:32:59
6f 03/29/13 17:59:03
Pro cess1 |s7|03/29/13 17:59:05
1234 03/29/13 20:33:43
L 03/29/13 20:33:54
A Process |45g|03/29/13 20:34:59
f4 03/29/13 21:10:22
B Pro cess |Es|03/30/13 00:11:25
23 03/30/13 00:47:20
E23 03/30/13 01:03:07
所需的輸出(插入|)
Process1 |5f|03/29/13 15:32:59
|6f|03/29/13 17:59:03
Pro cess1 |s7|03/29/13 17:59:05
|1234|03/29/13 20:33:43
|L|03/29/13 20:33:54
A Process |45g|03/29/13 20:34:59
|f4|03/29/13 21:10:22
B Pro cess |Es|03/30/13 00:11:25
|23 | 03/30/13 00:47:20
|E23| 03/30/13 01:03:07
這是GR8 ...只是編輯我輸入...道歉起初走不產生正確的輸入.... – Debaditya
@Chronicles好吧,我編輯了答案。儘管你可能需要擺弄空白。 – cnicutar
Away-some ..謝謝:) – Debaditya