14,953
edits
No edit summary |
(→BASH) |
||
| Line 42: | Line 42: | ||
== BASH == | == BASH == | ||
data preparation | |||
* (1) separate each string by [[Return symbol | return_symbol]] (2) [https://www.computerhope.com/unix/uuniq.htm uniq command] on Cygwin of {{Win}} or {{Linux}} | * (1) separate each string by [[Return symbol | return_symbol]] | ||
* (2) check the [https://www.computerhope.com/unix/uuniq.htm uniq command] is exists on Cygwin of {{Win}} or {{Linux}} | |||
* (3) execute the following command {{kbd | key=<nowiki>sort <file.txt> | uniq -ic | sort -nr</nowiki>}}<ref>[https://unix.stackexchange.com/questions/134446/counting-the-occurrences-of-the-string text processing - Counting the occurrences of the string - Unix & Linux Stack Exchange]</ref> | |||
file: test.txt | file: test.txt | ||
| Line 57: | Line 59: | ||
Result of the execution of command: {{kbd | key=<nowiki>sort test.txt | uniq -ic | sort -nr</nowiki>}} | Result of the execution of command: {{kbd | key=<nowiki>sort test.txt | uniq -ic | sort -nr</nowiki>}} | ||
<pre> | <pre> | ||
2 #Apple | |||
1 #電影 | 1 #電影 | ||
1 #追劇 | 1 #追劇 | ||
| Line 64: | Line 66: | ||
</pre> | </pre> | ||
Result of the execution of command: {{kbd | key=<nowiki>sort test.txt | uniq -c</nowiki>}} | |||
<pre> | |||
1 #Apple | |||
1 #apple | |||
1 #綜藝 | |||
1 #藍芽 | |||
1 #追劇 | |||
1 #電影 | |||
</pre> | |||
== References == | == References == | ||