我試圖在插入或刪除記錄後不斷重新編號文件中的記錄。該文件如下所示,具有> 100條記錄。如果例如第二條記錄被刪除,所有後面的記錄都需要重新編號,以便順序沒有間隔。任何想法如何在例如bash或awk(或perl)......如果它只是在理論上。在列表中連續編號多行記錄
記錄file.txt的:
# filter rule1
FilterRule1.match_message_facility = MME_E
FilterRule1.match_message_process = -1
FilterRule1.match_message_host = -1
FilterRule1.not_matched_facility_to_log_to = MME_E
FilterRule1.max_time_since_last_match_secs = 300
# incoming files
FilterRule2.match_message_facility = EXG
FilterRule2.match_message_event_severity = I
FilterRule2.match_message_host = -1
FilterRule2.not_matched_facility_to_log_to = EXG
FilterRule2.max_time_since_last_match_secs = 2000
# outgoing files
FilterRule3.match_message_facility = EXG
FilterRule3.match_message_event_severity = I
FilterRule3.match_message_host = -1
FilterRule3.not_matched_facility_to_log_to = EXG
FilterRule3.max_time_since_last_match_secs = 14400
# outgoing files: included headers
FilterRule4.match_message_facility = EXG
FilterRule4.match_message_event_severity = I
FilterRule4.match_message_host = -1
FilterRule4.not_matched_facility_to_log_to = EXG
FilterRule4.max_time_since_last_match_secs = 900
...
這是什麼記錄? – Vijay
和你嘗試失敗(和哪個錯誤)? – NeronLeVelu
CODE在哪裏? – serenesat