ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ
ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ

How to extract a specific information from a file

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Ibrahim Tariq Javed
Ibrahim Tariq Javed 2020๋…„ 7์›” 9์ผ
๋Œ“๊ธ€: madhan ravi 2020๋…„ 7์›” 9์ผ
Hello all,
I have a large file containing data like this
INFO [07-05|15:18:04.004] ๐Ÿ”จ mined potential block number=1078 hash="f6d5bdโ€ฆ58bea5"
INFO [07-05|15:18:04.004] Commit new mining work number=1079 sealhash="e686b6โ€ฆbceb85" uncles=0 txs=0 gas=0 fees=0 elapsed="508.656ยตs"
INFO [07-05|15:18:06.004] Successfully sealed new block number=1079 sealhash="e686b6โ€ฆbceb85" hash="b624ffโ€ฆc743ae" elapsed=1.999s
INFO [07-05|15:18:06.004] ๐Ÿ”— block reached canonical chain number=1072 hash="92fe2fโ€ฆfc6bf1"
INFO [07-05|15:18:06.004] ๐Ÿ”จ mined potential block number=1079 hash="b624ffโ€ฆc743ae"
INFO [07-05|15:18:06.004] Commit new mining work number=1080 sealhash="c2f151โ€ฆ17e0b6" uncles=0 txs=0 gas=0 fees=0 elapsed="515.946ยตs"
INFO [07-05|15:18:08.001] Successfully sealed new block number=1080 sealhash="c2f151โ€ฆ17e0b6" hash="f65eabโ€ฆ94b932" elapsed=1.996s
INFO [07-05|15:18:08.001] ๐Ÿ”— block reached canonical chain number=1073 hash="702ddeโ€ฆ1fcf2a"
INFO [07-05|15:18:08.001] ๐Ÿ”จ mined potential block number=1080 hash="f65eabโ€ฆ94b932"
INFO [07-05|15:18:08.002] Commit new mining work number=1081 sealhash="daee7dโ€ฆ2444ae" uncles=0 txs=0 gas=0 fees=0 elapsed="545.658ยตs"
INFO [07-05|15:18:10.004] Successfully sealed new block number=1081 sealhash="daee7dโ€ฆ2444ae" hash="baf0f0โ€ฆ68ffa6" elapsed=2.002s
INFO [07-05|15:18:26.000] Successfully sealed new block number=1089 sealhash="d645c1โ€ฆ1ed93b" hash="883415โ€ฆ4510e6" elapsed=1.995s
INFO [07-05|15:18:26.000] ๐Ÿ”— block reached canonical chain number=1082 hash="67aa36โ€ฆb89cd1"
INFO [07-05|15:18:26.000] ๐Ÿ”จ mined potential block number=1089 hash="883415โ€ฆ4510e6"
I want to extract the information elasped (the one in s and not in ยตs). I have underlined it
Can somebody help me. Thanks alot

๋‹ต๋ณ€ (1๊ฐœ)

Apoorv Singh
Apoorv Singh 2020๋…„ 7์›” 9์ผ
copy the whole text to a string. Then search for the keywork "elapsed". Consider the substring from this index till the end of each entry. Once you have this substring, you can further impose the condition that only values in seconds have to be considered.
This seems more like a hack than a nice solution, but I hope this helps :)
  ๋Œ“๊ธ€ ์ˆ˜: 1
madhan ravi
madhan ravi 2020๋…„ 7์›” 9์ผ
Could you illustrate?

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Foundation and Custom Domains์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by