Extract data from text file
조회 수: 1 (최근 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
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Export에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!