我有一個grep和排序記錄的要求,首先通過mdmId(您可以看到它出現在文本mdmId朝向行尾後),然後通過行號或時間 - 郵票(出現在線條的開始)需要根據2個條件grep和排序記錄
電流輸出:
$ grep -F -n -f grp_param cmxserver.log
43723:[2015-09-09 11:18:14,819] [threadExecutor-8] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834699
43896:[2015-09-09 11:18:16,085] [threadExecutor-8] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
43900:[2015-09-09 11:18:16,086] [threadExecutor-8] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
43902:[2015-09-09 11:18:16,086] [threadExecutor-8] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834699
45057:[2015-09-09 11:18:52,952] [threadExecutor-10] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834699
45247:[2015-09-09 11:18:54,067] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834947
45296:[2015-09-09 11:18:54,093] [threadExecutor-10] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
45300:[2015-09-09 11:18:54,100] [threadExecutor-10] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
45302:[2015-09-09 11:18:54,100] [threadExecutor-10] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834699
45623:[2015-09-09 11:18:55,603] [threadExecutor-1] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
45627:[2015-09-09 11:18:55,605] [threadExecutor-1] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
45629:[2015-09-09 11:18:55,605] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834947
45779:[2015-09-09 11:18:57,161] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834947
所需的輸出:
43896:[2015-09-09 11:18:16,085] [threadExecutor-8] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
43900:[2015-09-09 11:18:16,086] [threadExecutor-8] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
45296:[2015-09-09 11:18:54,093] [threadExecutor-10] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
45300:[2015-09-09 11:18:54,100] [threadExecutor-10] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
45623:[2015-09-09 11:18:55,603] [threadExecutor-1] [INFO ] com.delos: Completed the beforeEverything - mdmId is :
45627:[2015-09-09 11:18:55,605] [threadExecutor-1] [INFO ] com.delos: *****CustomerSaveHandler - beforeSave **** - mdmId is :
43723:[2015-09-09 11:18:14,819] [threadExecutor-8] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834699
43902:[2015-09-09 11:18:16,086] [threadExecutor-8] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834699
45057:[2015-09-09 11:18:52,952] [threadExecutor-10] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834699
45302:[2015-09-09 11:18:54,100] [threadExecutor-10] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834699
45247:[2015-09-09 11:18:54,067] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeEverything - mdmId is : 834947
45629:[2015-09-09 11:18:55,605] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834947
45779:[2015-09-09 11:18:57,161] [threadExecutor-1] [INFO ] com.delos: CustomerSaveHandler - beforeSave - beforeSave - CustomerRelationship - The mdmId is : 834947
您可以在所需的輸出看,與mdmId空第一條記錄被拾取並根據行號(或時間戳)進行排序。其次是Id 834699和Id 834947。
您的幫助表示讚賞。
感謝
並不是所有的線路都mdmId值 – fedorqui
是。並非所有行都有mdmId值。 – Sourabh