Text statistics


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Text statistics
# 8  
Old 10-06-2013
The double square brackets are important - the character class [:alpha:] replaces a-zA-Z, you still need the outer brackets to denote a bracket expression.
Code:
$ grep -Ewo "[[:alpha:]]" all.txt | sort | uniq -c | sort -k1,1rd | head -30
     98 ا
     62 ل
     61 و
     53 م
     43 ر
     35 ن
     32 ي
     31 ه
     29 ت
     24 د
     21 أ
     21 ف
     20 ك
     19 ع
     18 ب
     16 س
     12 ق
     11 ة
     10 ح
      7 ذ
      7 ط
      6 ء
      6 خ
      6 ض
      6 ى
      5 ش
      4 إ
      4 ج
      3 ث
      3 ص

This User Gave Thanks to CarloM For This Post:
# 9  
Old 10-06-2013
Thanks a lot
it works for character

but how to find top 30 words and trigraphs (3 letter in same order)?

---------- Post updated at 08:06 PM ---------- Previous update was at 07:41 PM ----------

I tried this one for trigraphs and it works

Code:
 
grep -Ewo "[[:alpha:]]"{3} education.txt | sort | uniq -c | sort -k1,1rd | head -5>result




but still need how to get top 30 words ?



Last edited by khaled79; 10-06-2013 at 09:58 PM..
# 10  
Old 10-06-2013
Did you try ChublerXL's other solutions (amended to use the character class)?
# 11  
Old 10-06-2013
Thanks

the problem of top words has been solved by

Code:
 
grep -Ewo "[[:alpha:]]""{2,}" education.txt | sort | uniq -c | sort -k1,1rd | head -5>result


output

Code:
 
37 علم
     30 إلى
     28 على
     18 التي
     18 الكيمياء

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Red Hat

CPU Usage statistics Dump in a text file over a period of time

I am facing issue related to performance of one customized application running on RHEL 5.9. The application stalls for some unknown reason that I need to track. For that I require some tool or shell scripts that can monitor the CPU usage statistics (what we get in TOP or in more detail by other... (6 Replies)
Discussion started by: Anjan Ganguly
6 Replies

2. UNIX for Dummies Questions & Answers

Any way to get process statistics?

Hi, Can someone advise what "generic" command can I use to show statistics of a process or a running script/process? For example, I want to know how many hours/minutes it's taken to run or has been running, how much CPU it used and how much memory it used or uses. I want to be able to... (2 Replies)
Discussion started by: newbie_01
2 Replies

3. Solaris

Anyone help to interpretate os statistics

Hi, Can anyone help me to explain following statistics of my unix box. /usr/sbin/swap -l swapfile dev swaplo blocks free /dev/dsk/c4 118,771 16 33560432 33319776 /dev/dsk/c4 118,763 16 33560432 33327184 /usr/sbin/swap -s total: 13429368k bytes allocated + 9830880k reserved =... (9 Replies)
Discussion started by: giteshtrivedi
9 Replies

4. Shell Programming and Scripting

statistics using awk

Hi, I have 3 columns in a file listed below. X Y X/(X+Y) 1 1 0.5 1 1 0.5 4 1 0.8 1 1 0.5 6 1 0.857142857 1 1 0.5 23 1 0.958333333 Now I want to find confidence interval using the formula for each row. (p-2 sqrt p(1-p)/(x+y), p+2... (7 Replies)
Discussion started by: Diya123
7 Replies

5. AIX

Statistics Aix

Hello If there is a way to get a statistics from Aix box server from a month. cpu use, memory, disc use, etc. Maybe via smitty or I need to do a script. The os is Aix 5.3 Greetings (8 Replies)
Discussion started by: lo-lp-kl
8 Replies

6. HP-UX

packets statistics

Hi there, are there any functions that can get the packets statistics on UNIX ? thanks. (2 Replies)
Discussion started by: Frank2004
2 Replies

7. Solaris

how to get server statistics

Hello What commands can give following type of information about the server: Time: 20080331.12:10:39 Current CPU: 97.0% Current Memory: 3.7% Current Disk Space: 76% The resources on server is currently not available. Current CPU, Memory, or Disk Space is exceeding threshold Waiting for... (2 Replies)
Discussion started by: shalua
2 Replies

8. Programming

Server Statistics ?

I'm trying to write a C program to view server statistics such as: - server general information - CPU usage - memory usage - running processes Cany anybody gives me hints on those system calls ?? ps: I'm using Tru64 unix (6 Replies)
Discussion started by: Agent007
6 Replies
Login or Register to Ask a Question