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:
Extract data from text file
15 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Standard File Formats 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!