с использованием awk для сбора данных из динамического местоположения

Сделайте это на лету:

csv-parser -f <(cat my-huge.csv | sed '4125878d')
0
20.02.2018, 15:54
4 ответа

Su salida de muestra indica que la "referencia indefinida" siempre será el campo final awkde una línea. En awk, NFserá el número de campos, y $NFserá aquel campo cuyo número es "el número de campos", es decir. el campo final, que es lo que está pidiendo.

awk '{print "undefined reference = " $NF}'
1
28.01.2020, 02:32

the path of the source file, line number, and the undefined reference to

sedsolución:

sed -E 's/^([^:]+):([0-9]+): error: undefined reference to (.*)/\1 \2 \3/' file

La salida:

out/target/product/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h 408 'fishy_proto::Service::CopyFrom(fishy_proto::Service const&)'
base/fishy/fishy/impl/service.cpp 448 'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service.cpp 489 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service.cpp 489 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp 51 'fishy_proto::ServiceList::ServiceList()'
base/fishy/fishy/impl/service_registry.cpp 51 'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp 51 'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp 51 'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp 51 'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp 279 'fishy_proto::Request::Request()'
base/fishy/fishy/impl/service_registry.cpp 319 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp 319 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp 722 'fishy_proto::Request::Request()'
out/target/product/phaedra/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h 72 'fishy_proto::Request_Type_descriptor()'
base/fishy/fishy/impl/service_registry.cpp 762 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp 762 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp 463 'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service_registry.cpp 500 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp 500 'fishy_proto::Service::~Service()'
external/protobuf/src/google/protobuf/arena.h 649 'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h 309 'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h 649 'fishy_proto::Service::Service()'
external/protobuf/src/google/protobuf/arena.h 309 'fishy_proto::Service::Service()'
1
28.01.2020, 02:32

Si no te importa usar perl:

perl -pe 's/^(.*?):(\d+): error: undefined reference to (.*)/\1\t\2\t\3/g'

La salida de su ejemplo se vería así:

out/target/product/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h    408 'fishy_proto::Service::CopyFrom(fishy_proto::Service const&)'
base/fishy/fishy/impl/service.cpp   448 'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service.cpp   489 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service.cpp   489 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp  51  'fishy_proto::ServiceList::ServiceList()'
base/fishy/fishy/impl/service_registry.cpp  51  'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp  51  'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp  51  'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp  51  'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp  279 'fishy_proto::Request::Request()'
base/fishy/fishy/impl/service_registry.cpp  319 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp  319 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp  722 'fishy_proto::Request::Request()'
out/target/product/phaedra/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h    72  'fishy_proto::Request_Type_descriptor()'
base/fishy/fishy/impl/service_registry.cpp  762 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp  762 'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp  463 'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service_registry.cpp  500 'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp  500 'fishy_proto::Service::~Service()'
external/protobuf/src/google/protobuf/arena.h   649 'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h   309 'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h   649 'fishy_proto::Service::Service()'
external/protobuf/src/google/protobuf/arena.h   309 'fishy_proto::Service::Service()'
0
28.01.2020, 02:32

Lo he hecho con el siguiente método usando sed

sed -ne "s/\(.*error:\)\(.*reference to \)\('.*'\)/\1\3/p" inputfile

Salida

out/target/product/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h:408: error:'fishy_proto::Service::CopyFrom(fishy_proto::Service const&)'
base/fishy/fishy/impl/service.cpp:448: error:'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service.cpp:489: error:'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service.cpp:489: error:'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp:51: error:'fishy_proto::ServiceList::ServiceList()'
base/fishy/fishy/impl/service_registry.cpp:51: error:'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp:51: error:'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp:51: error:'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp:51: error:'fishy_proto::ServiceList::~ServiceList()'
base/fishy/fishy/impl/service_registry.cpp:279: error:'fishy_proto::Request::Request()'
base/fishy/fishy/impl/service_registry.cpp:319: error:'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp:319: error:'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp:722: error:'fishy_proto::Request::Request()'
out/target/product/phaedra/gen/SHARED_LIBRARIES/libfishy_proto_intermediates/proto/base/fishy/fishy/prefix/fishy_proto/service_registry.pb.h:72: error:'fishy_proto::Request_Type_descriptor()'
base/fishy/fishy/impl/service_registry.cpp:762: error:'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp:762: error:'fishy_proto::Request::~Request()'
base/fishy/fishy/impl/service_registry.cpp:463: error:'fishy_proto::Service::Service()'
base/fishy/fishy/impl/service_registry.cpp:500: error:'fishy_proto::Service::~Service()'
base/fishy/fishy/impl/service_registry.cpp:500: error:'fishy_proto::Service::~Service()'
external/protobuf/src/google/protobuf/arena.h:649: error:'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h:309: error:'fishy_proto::ServiceGroup::ServiceGroup()'
external/protobuf/src/google/protobuf/arena.h:649: error:'fishy_proto::Service::Service()'
external/protobuf/src/google/protobuf/arena.h:309: error:'fishy_proto::Service::Service()'
0
28.01.2020, 02:32

Теги

Похожие вопросы