Timeline for I would like to find and count number of entries bigger than a certain number in front of a certain string
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 4, 2020 at 10:25 | vote | accept | baxbear | ||
Apr 18, 2020 at 21:26 | comment | added | baxbear |
Thank you very much! In my case grep needs to use -o since some of the results are in the same line. Afterwards I count the output with | wc -l => <.log grep -o "'avg_deg': [4]" | wc -l and <.log grep -o "'avg_deg': [5]\.[56789][0123456789][0123456789]*" | wc -l and finally <.log grep -o "'avg_deg': [6]" | wc -l . I still have to check and understand the sed command of yours to use it.
|
|
Apr 17, 2020 at 19:33 | comment | added | D. Ben Knoble♦ |
This is not fundamentally a vim exercise... use grep (or your favorite tools)—it's likely to be faster, not consume as much memory (31M to load the file!), and allow you trim out more correctly your search pattern. Example: <big-file grep -c "avg_deg': [5]\.[56789]" . If you need average, awk is good but lacks fixed/floating point support, so use something like sed 's/\([[:digit:]]\)\.\([[:digit:]]\)/\1\2/g' to convert everything to 3-digit ints
|
|
Apr 17, 2020 at 18:27 | answer | added | Maxim Kim | timeline score: 1 | |
Apr 17, 2020 at 18:13 | comment | added | Maxim Kim | You could create simplified example of the data, though | |
Apr 17, 2020 at 17:48 | history | edited | baxbear | CC BY-SA 4.0 |
added 373 characters in body
|
Apr 17, 2020 at 17:39 | comment | added | baxbear | Tried to add just one array of the .log and intended to add further parts of the .log - but already that single array killed my browser after the website decided not to respond anymore... so basically you find lots of dictionaries with arrays with dictionaries with entries. The "'avg_deg': 5.50" appears for each test case twice in the file but that shouldn't matter since for the intended operations the first result has to be divided by 2 and the second should be even exactly the same. Actually I intended to save the result as .json but python just failed doing it on the variable size. | |
Apr 17, 2020 at 17:26 | comment | added | Zorzi | Maybe a sample of your document would help | |
Apr 17, 2020 at 17:12 | history | asked | baxbear | CC BY-SA 4.0 |