Ich habe hier eine Aufgabe, um die Dateinamen aus einer Protokolldatei, die etwa 1000 Zeilen enthält extrahieren, im Protokoll beginnt jede Zeile mit dem Dateinamen gefolgt von anderen Details, I Nun möchte ich jeden Dateinamen (absoluter Pfad, beginnend mit './') aus jeder Zeile extrahieren und in eine Datei einfügen. Eine Beispielprotokolldatei enthält die folgenden Daten.Shell-Skript, um Zeilen zu schneiden und den ersten Teil
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_overview.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_old_db.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchange.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_channel.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_vhosts.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_permission.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_util.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_purge.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_format.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_exchanges.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_bindings.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_definitions.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-management/src/rabbit_mgmt_wm_queue_get.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-federation-management/src/rabbit_federation_mgmt.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_processor.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_util.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_collector.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_frame.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt_sup.erl:1:%% The contents of this file are subject to the Mozilla Public License
./plugins-src/rabbitmq-mqtt/src/rabbit_mqtt.erl:1:%% The contents of this file are subject to the Mozilla Public License
gibt es einen Doppelpunkt (:), die als Trennzeichen verwendet werden kann, die genau die Dateinamen in jeder Zeile enden, aber ich habe keine Erfahrung in Shell-Skript es in Scheiben schneiden und die Dateinamen zu extrahieren.
war es so einfach !!! ... danke ... :) es hat mir den Tag gerettet. –
Froh, das zu hören, wenn es dann geholfen hat, bitte akzeptieren Sie die Antwort. –