确认打印在一行中找到的匹配项,而不是多行

确认打印在一行中找到的匹配项,而不是多行

现在 ack 会打印出所有以换行符分隔的匹配项。我希望一行中的所有匹配项也打印在一行上……可以吗?

我可以添加--with filename 来打印出匹配的行号,然后做一些其他的事情来再次组合它,但我不想这样做。

我的命令:

ack -o --with-filename '(route_start_date)"([^,]*)"|(route_end_date)"([^,]*)"|(route_status)"([^,]*)"|(route_name)"([^,]*)"|(PARTNER_GUID)"([^,]*)"' sample.txt

示例文本:

"[{""tracking_id"":""adc8fd04-26cf-41c2-b238-bf20b1cb81ea"",""creation_date"":""2019-02-14T19:03:43.231Z"",""field_"":{""field_CAIDS"":""[MOVE1021000001875586,PREV1021000001885016]"",""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_MAID"":""MOVE1021000001875586"",""field_MERLIN_GUID"":""starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PAID"":""PKGE1021000001875586"",""field_PARTNER_GUID"":""value:starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PROVIDER"":""ENCORE"",""field_PROVIDER_ID"":""starzencore.com"",""field_TAID"":""TITL1021000001875586"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:43.337Z"",""route_name"":""DETERMINE_system_ROUTING_SERVICE"",""route_start_date"":""2019-02-14T19:03:43.233Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Successful completion of DETERMINE_system_ROUTING_SERVICE""},{""tracking_id"":""f71ae809-a562-4153-880c-9765bfe98016"",""creation_date"":""2019-02-14T19:03:57.731Z"",""field_"":{""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_PAID"":""PKGE1021000001875586"",""field_PROVIDER_ID"":""starzencore.com"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:58.629Z"",""route_name"":""MEZZ_INGEST_SERVICE"",""route_start_date"":""2019-02-14T19:03:57.740Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Task waitForAdditionalAdiTask was skipped.\nSuccessful completion of MEZZ_INGEST_SERVICE""},{""tracking_id"":""0943eebf-9c25-478c-82be-bb537d21ad70"",""creation_date"":""2019-02-14T19:03:43.358Z"",""field_"":{""field_CAIDS"":""[MOVE1021000001875586,PREV1021000001885016]"",""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_MAID"":""MOVE1021000001875586"",""field_MERLIN_GUID"":""starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PAID"":""PKGE1021000001875586"",""field_PARTNER_GUID"":""value:starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PROVIDER"":""ENCORE"",""field_PROVIDER_ID"":""starzencore.com"",""field_TAID"":""TITL1021000001875586"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:44.113Z"",""route_name"":""DETERMINE_ADI_TYPE_SERVICE"",""route_start_date"":""2019-02-14T19:03:43.378Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Successful completion of DETERMINE_ADI_TYPE_SERVICE""},{""tracking_id"":""1ed32106-f8fd-4ee7-a7f8-b1adef70a284"",""creation_date"":""2019-02-14T19:03:44.137Z"",""field_"":{""field_CAIDS"":""[MOVE1021000001875586,PREV1021000001885016]"",""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_MAID"":""MOVE1021000001875586"",""field_MERLIN_GUID"":""starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PAID"":""PKGE1021000001875586"",""field_PARTNER_GUID"":""value:starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PROVIDER"":""ENCORE"",""field_PROVIDER_ID"":""starzencore.com"",""field_TAID"":""TITL1021000001875586"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:44.318Z"",""route_name"":""ADI_INGEST_SERVICE"",""route_start_date"":""2019-02-14T19:03:44.142Z"",""route_status"":""CANCELLED"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Task ingestCheckPackageCompleteTask is in status CANCELLED Message : The following files have not been received: 1875586_ep303smallclaimscourt_version_2_0.mezz""},{""tracking_id"":""b2b0bd91-7675-4e62-9afd-246ab01d788b"",""creation_date"":""2019-02-14T19:03:42.667Z"",""field_"":{""field_CAIDS"":""[MOVE1021000001875586,PREV1021000001885016]"",""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_MAID"":""MOVE1021000001875586"",""field_MERLIN_GUID"":""starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PAID"":""PKGE1021000001875586"",""field_PARTNER_GUID"":""value:starzencore.comTITL1021000001875586-MOVE1021000001875586"",""field_PROVIDER"":""ENCORE"",""field_PROVIDER_ID"":""starzencore.com"",""field_TAID"":""TITL1021000001875586"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:43.202Z"",""route_name"":""ADI_CONDITIONING_SERVICE"",""route_start_date"":""2019-02-14T19:03:42.671Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Successful completion of ADI_CONDITIONING_SERVICE""},{""tracking_id"":""3b141bb2-3d1b-4832-bb0c-41f2b3798ab0"",""creation_date"":""2019-02-14T19:03:58.807Z"",""field_"":{""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_PAID"":""PKGE1021000001875586"",""field_PROVIDER_ID"":""starzencore.com"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:04:04.216Z"",""route_name"":""SEND_TO_MPX_INGEST_SERVICE"",""route_start_date"":""2019-02-14T19:03:58.861Z"",""route_status"":""FAILED"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Task captionMakerWebServiceTask was skipped.\nTask captionMakerWebServiceTask was skipped.\nTask adiVersionConditioningTask was skipped.\nTask ingestUpdateManifestTask is in status FAILED Message : 027659c0-319d-4e58-998c-7cb89bd14477.MPG is found in the package but not found in Manifest file,Can not update Alias or  xpath is not found//mezzIngest/AssetMetadata/mediaFile/originalLocation[text()[contains(.,'%s')]]/..""},{""tracking_id"":""3607d0a0-308b-11e9-bd27-2b4a56171e70"",""creation_date"":""2019-02-14T19:03:27.665Z"",""field_"":{""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:57.709Z"",""route_name"":""INGEST_SERVICE"",""route_start_date"":""2019-02-14T19:03:27.668Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Successful completion of INGEST_SERVICE""},{""tracking_id"":""851013d2-b731-4d98-8ece-7ea436575b6a"",""creation_date"":""2019-01-31T19:41:15.029Z"",""field_"":{""field_PAID"":""PKGE1021000001875586"",""field_PROVIDER_ID"":""starzencore.com""},""priority"":5,""route_end_date"":""2019-01-31T19:41:21.483Z"",""route_name"":""CONTENT_INGEST_SERVICE"",""route_start_date"":""2019-01-31T19:41:15.036Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Task waitForAdditionalAdiTask was skipped.\nSuccessful completion of CONTENT_INGEST_SERVICE""},{""tracking_id"":""d96ad11c-1f48-4713-aab5-d58bb6aee480"",""creation_date"":""2019-02-14T19:03:27.748Z"",""field_"":{""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_PAID"":""PKGE1021000001875586"",""field_PROVIDER_ID"":""starzencore.com"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:27.936Z"",""route_name"":""META_INGEST_SERVICE"",""route_start_date"":""2019-02-14T19:03:27.753Z"",""route_status"":""CANCELLED"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Task ingestCheckPackageCompleteTask is in status CANCELLED Message : The following files have not been received: 1875586_ep303smallclaimscourt_version_2_0.mezz, 1875586_ep303smallclaimscourt_version_2_0.xml""},{""tracking_id"":""2c1ff527-7dcf-4eeb-be55-17ef7c479e8b"",""creation_date"":""2019-02-14T19:03:58.657Z"",""field_"":{""field_DIRECTORY"":""/ch2/a700/watchfolder/starzvod/234128"",""field_PAID"":""PKGE1021000001875586"",""field_PROVIDER_ID"":""starzencore.com"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-14T19:03:58.789Z"",""route_name"":""PREPARE_FOR_MPX_TRANSFER_SERVICE"",""route_start_date"":""2019-02-14T19:03:58.661Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffe8689-7bf0-436f-be63-ebb59fe3dcab"",""status_message"":""Successful completion of PREPARE_FOR_MPX_TRANSFER_SERVICE""}]"
"[{""tracking_id"":""48461157-f585-4f6c-8104-aedcb88a0dca"",""creation_date"":""2019-02-09T16:03:39.561Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:39.763Z"",""route_name"":""DETERMINE_system_ROUTING_SERVICE"",""route_start_date"":""2019-02-09T16:03:39.565Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of DETERMINE_system_ROUTING_SERVICE""},{""tracking_id"":""cee53404-3fb3-414e-bbac-2a8934311567"",""creation_date"":""2019-02-09T15:55:19.274Z"",""field_"":{""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T15:55:19.656Z"",""route_name"":""MEZZ_INGEST_SERVICE"",""route_start_date"":""2019-02-09T15:55:19.283Z"",""route_status"":""CANCELLED"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Task ingestCheckPackageCompleteTask is in status CANCELLED Message : The following files have not been received: Oddities_405_PROD001_mezz.mov, Oddities_405_PROD001_mezz_HD.xml, Oddities_405_PROD001_mezz_SD.xml, Oddities_405_PROD001_mezzcc.scc""},{""tracking_id"":""9cce7b21-301c-485f-9005-2d111a7d3730"",""creation_date"":""2019-02-09T16:03:39.788Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:40.614Z"",""route_name"":""DETERMINE_ADI_TYPE_SERVICE"",""route_start_date"":""2019-02-09T16:03:39.809Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of DETERMINE_ADI_TYPE_SERVICE""},{""tracking_id"":""9904e341-a43e-4832-a8de-e6fbdb8e41c3"",""creation_date"":""2019-02-09T16:03:40.648Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:41.577Z"",""route_name"":""ADI_INGEST_SERVICE"",""route_start_date"":""2019-02-09T16:03:40.654Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Task waitForAdditionalAdiTask was skipped.\nSuccessful completion of ADI_INGEST_SERVICE""},{""tracking_id"":""01b8e892-2138-42de-b6bd-5120defc8716"",""creation_date"":""2019-02-09T16:04:50.089Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:04:50.368Z"",""route_name"":""NOOP_SERVICE"",""route_start_date"":""2019-02-09T16:04:50.183Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of NOOP_SERVICE""},{""tracking_id"":""0d1a25a1-d818-42a5-b6ec-9977d6f5258d"",""creation_date"":""2019-02-09T16:03:38.626Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:39.515Z"",""route_name"":""ADI_CONDITIONING_SERVICE"",""route_start_date"":""2019-02-09T16:03:38.633Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of ADI_CONDITIONING_SERVICE""},{""tracking_id"":""d95ffe79-9e12-4390-97c3-786846055f28"",""creation_date"":""2019-02-09T16:03:42.031Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:04:49.624Z"",""route_name"":""SEND_TO_MPX_INGEST_SERVICE"",""route_start_date"":""2019-02-09T16:03:42.176Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of SEND_TO_MPX_INGEST_SERVICE""},{""tracking_id"":""34327ce0-2c84-11e9-bff5-d1ea0d6bc0ee"",""creation_date"":""2019-02-09T16:03:13.454Z"",""field_"":{""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:13.928Z"",""route_name"":""INGEST_SERVICE"",""route_start_date"":""2019-02-09T16:03:13.458Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of INGEST_SERVICE""},{""tracking_id"":""a1ca69f2-27f1-4c8d-8611-6cbd7cdab453"",""creation_date"":""2019-02-09T16:03:41.616Z"",""field_"":{""field_CAIDS"":""[EHMV0001549545794913,]"",""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_MAID"":""EHMV0001549545794913"",""field_MERLIN_GUID"":""value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PAID"":""EHPK0001549545794913"",""field_PARTNER_GUID"":""value:value.comEHTL0001549545794913-EHMV0001549545794913"",""field_PROVIDER"":""DISCOVERY_TV_HD_EST"",""field_PROVIDER_ID"":""value.com"",""field_TAID"":""EHTL0001549545794913"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:42.002Z"",""route_name"":""PREPARE_FOR_MPX_TRANSFER_SERVICE"",""route_start_date"":""2019-02-09T16:03:41.707Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of PREPARE_FOR_MPX_TRANSFER_SERVICE""},{""tracking_id"":""8747a20f-7ae1-4336-8f04-15d8343ffab8"",""creation_date"":""2019-02-09T16:03:13.955Z"",""field_"":{""field_DIRECTORY"":""/watchfolder/wdpvod/Oddities_405_PROD001_mezz_manifest"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-09T16:03:14.755Z"",""route_name"":""CONTENT_INGEST_SERVICE"",""route_start_date"":""2019-02-09T16:03:13.963Z"",""route_status"":""CANCELLED"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Task ingestCheckPackageCompleteTask is in status CANCELLED Message : The following files have not been received: Oddities_405_PROD001_mezz_HD.xml, Oddities_405_PROD001_mezz_SD.xml""},{""tracking_id"":""10777f30-2ccf-11e9-bd27-2b4a56171e70"",""creation_date"":""2019-02-10T00:59:05.769Z"",""field_"":{""field_CAIDS"":""[]"",""field_WATERMARK_PARTNER"":""value""},""priority"":5,""route_end_date"":""2019-02-10T00:59:05.992Z"",""route_name"":""ADI_TRANSFORMATION_SERVICE"",""route_start_date"":""2019-02-10T00:59:05.773Z"",""route_status"":""SUCCESSFUL"",""source_reference_id"":""fffd01a0-fac8-4f4b-a21f-9572eba82f0b"",""status_message"":""Successful completion of ADI_TRANSFORMATION_SERVICE""}]"

而不是看到:

routes.txt:1:route_name"":""PREPARE_FOR_MPX_TRANSFER_SERVICE""
routes.txt:1:route_start_date"":""2019-02-14T19:03:58.661Z""
routes.txt:1:route_status"":""SUCCESSFUL""
routes.txt:2:route_end_date"":""2019-02-16T00:40:19.622Z""
routes.txt:2:route_name"":""SEND_TO_MPX_LSA""
routes.txt:2:route_start_date"":""2019-02-16T00:35:11.933Z""
routes.txt:2:route_status"":""SUCCESSFUL""

我倒要看看

routes.txt:1:route_name"":""PREPARE_FOR_MPX_TRANSFER_SERVICE"" routes.txt:1:route_start_date"":""2019-02-14T19:03:58.661Z"" routes.txt:1:route_status"":""SUCCESSFUL""
routes.txt:2:route_end_date"":""2019-02-16T00:40:19.622Z"" routes.txt:2:route_name"":""SEND_TO_MPX_LSA"" routes.txt:2:route_start_date"":""2019-02-16T00:35:11.933Z"" routes.txt:2:route_status"":""SUCCESSFUL""

每行是否重复 routes.txt:#...但我可以稍后处理

答案1

我希望一行中的所有匹配项也打印在一行上...可能吗?

不,这是不可能的。ack 将每个匹配项在其自己的行上输出。

$ cat foo.txt
The cat sat on the hat.
$ ack -o '\wat' foo.txt
cat
sat
hat

不仅如此,您似乎使用了错误的工具来完成这项工作。如果我理解正确的话,文件中的每一行都是一个 JSON 记录,并且您尝试从每个 JSON 记录中提取四个字段。我会查看一个用于处理 JSON 数据的工具。 jq是此操作的标准工具: https://stedolan.github.io/jq/

相关内容