Timeline for how to use of grep to find information from a structured text file
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 16, 2022 at 10:46 | comment | added | terdon♦ | @ZerosOnesTwos my only advice is not to use grep. It simply is the wrong tool for the job. You can't do this sort of calculation in grep alone. Look into tools like awk. | |
Nov 15, 2022 at 20:44 | comment | added | ZerosOnesTwos |
do you have any advice on how I could find the year that appears the most in the text file using grep ?
|
|
Nov 15, 2022 at 20:05 | vote | accept | ZerosOnesTwos | ||
Nov 15, 2022 at 20:03 | comment | added | ZerosOnesTwos |
I used grep -E "^([^,]*,){5}[2-9][0-9][0-9][0-9][0-9][0-9][0-9]" and it seems to work for minimum 2 million sales
|
|
Nov 15, 2022 at 19:59 | comment | added | ZerosOnesTwos | Thanks for the great explanation. I see that the application of grep for this is pretty bad, these were just some extracurricular tasks that limited me to using grep. I was trying to figure out the application and use of different wildcards, your explanation helped a lot. For the 2million part using grep, could I preface the field to start with [2-9 ]followed by 6 [0-9]? | |
Nov 15, 2022 at 19:48 | history | answered | terdon♦ | CC BY-SA 4.0 |