Timeline for Get text-file word occurrence count of all words & print output sorted
Current License: CC BY-SA 3.0
18 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 26, 2019 at 19:10 | comment | added | smc |
@seler I think you can make the grep and tr part even simpler like below: echo "Lorem ipsum dolor sit sit amet et cetera." | tr ' ' '\n' | grep -v "^$" | sort | uniq -c | sort -bnr Note that I am a beginner, so I may be wrong, please feel free to advise.
|
|
| Jan 16, 2017 at 7:23 | history | edited | seler | CC BY-SA 3.0 |
This was never intended to be a executable file shell script. Somebody first splitted it into lines, then somebody else slapped shebang at the beginning. Let it be as it is - just a copy paste line with ton of pipes.
|
| S Jan 14, 2017 at 22:47 | history | suggested | Nevin Williams | CC BY-SA 3.0 |
Added a shebang to the script; it doesn't run under tcsh as is.
|
| Jan 14, 2017 at 22:32 | review | Suggested edits | |||
| S Jan 14, 2017 at 22:47 | |||||
| S Jan 14, 2017 at 22:24 | history | edited | grochmal | CC BY-SA 3.0 |
I wanted to add a \ to the code snippet so it could be copied and pasted, but there's an 8 character minimum on edits, so I removed the spaces and CR instead. EXTRA: you can divide lines on pipes, and the shell will understand
|
| S Jan 14, 2017 at 22:24 | history | suggested | Nevin Williams | CC BY-SA 3.0 |
I wanted to add a \ to the code snippet so it could be copied and pasted, but there's an 8 character minimum on edits, so I removed the spaces and CR instead.
|
| Jan 14, 2017 at 22:20 | review | Suggested edits | |||
| S Jan 14, 2017 at 22:24 | |||||
| Nov 30, 2016 at 20:35 | history | edited | Stéphane Chazelas | CC BY-SA 3.0 |
missing quotes around shell glob, POSIXified
|
| Nov 4, 2015 at 13:07 | comment | added | Noor | nice command, really deserve a vote up :) | |
| Sep 6, 2015 at 12:04 | comment | added | Skippy le Grand Gourou |
-g (--general-numeric-sort) option of sort may be preferable in some cases. E.g. sort -n will keep 10\n1 4 as is, treating 1 4 as 14, while sort -g will treat it correctly as 1 4\n10.
|
|
| May 22, 2012 at 4:09 | vote | accept | CommunityBot | ||
| May 21, 2012 at 7:10 | comment | added | seler | @Arcege: Good point. Although it wont change the result it may fasten script a little bit. | |
| May 21, 2012 at 0:02 | comment | added | Arcege |
Might want to use tr -s to handle multiple spaces, especially when encountering indentation.
|
|
| May 20, 2012 at 13:57 | history | edited | manatwork | CC BY-SA 3.0 |
escaped Markdown in the spoiler
|
| May 20, 2012 at 12:09 | history | edited | seler | CC BY-SA 3.0 |
added 118 characters in body
|
| May 20, 2012 at 12:02 | history | edited | seler | CC BY-SA 3.0 |
added 3 characters in body
|
| May 20, 2012 at 11:56 | history | edited | seler | CC BY-SA 3.0 |
added 3 characters in body
|
| May 20, 2012 at 11:46 | history | answered | seler | CC BY-SA 3.0 |