Extract data from text file

1 vue (au cours des 30 derniers jours)
Aya
Aya le 1 Nov 2020
Modifié(e) : Mario Malic le 2 Nov 2020
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

Réponse acceptée

Mario Malic
Mario Malic le 1 Nov 2020
Modifié(e) : Mario Malic le 2 Nov 2020
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:

Plus de réponses (0)

Catégories

En savoir plus sur Data Import and Export dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by