Extract data from text file

1 回表示 (過去 30 日間)
Aya
Aya 2020 年 11 月 1 日
編集済み: Mario Malic 2020 年 11 月 2 日
Hello! Please help me. I need a code to extract data from a large text file.
This includes data like this:
146.204.224.152 - feest6811 [21/Jun/2019:15:45:24 -0700] "POST /incentivize HTTP/1.1" 302 4622
197.109.77.178 - kertzmann3129 [21/Jun/2019:15:45:25 -0700] "DELETE /virtual/solutions/target/web+services HTTP/2.0" 203 26554
156.127.178.177 - okuneva5222 [21/Jun/2019:15:45:27 -0700] "DELETE /interactive/transparent/niches/revolutionize HTTP/1.1" 416 14701
159.253.153.40 - - [21/Jun/2019:15:46:10 -0700] "POST /e-business HTTP/1.0" 504 19845
100.32.205.59 - ortiz8891 [21/Jun/2019:15:45:28 -0700] "PATCH /architectures HTTP/1.0" 204 6048
233.187.15.207 - - [21/Jun/2019:15:46:14 -0700] "GET /harness/intuitive HTTP/1.0" 304 21006
168.95.156.240 - stark2413 [21/Jun/2019:15:45:31 -0700] "GET /engage HTTP/2.0" 201 9645
It is needed to be converted into a list of strings like this:
"host: 146.204.224.152"
"username: feest6811"
"time: 21/Jun/2019:15:45:24 -0700"
"request: POST /incentivize HTTP/1.1"
sometimes there are no username so instead it is changed into a dash line

採用された回答

Mario Malic
Mario Malic 2020 年 11 月 1 日
編集済み: Mario Malic 2020 年 11 月 2 日
I am going to post this as an answer without it being one, this question has been answered few times already in the last couple of days, here are some links to the questions:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Export についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by