Doubt


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Doubt
# 1  
Old 08-04-2011
Doubt

Hi,

I have a file with multiple entries and I have calculated the percentages. Now I want to know how many of my entries are there between 1-10% 11-20% and so on..


Code:
chr1_14401_14450    0.211954217888936
chr1_14451_14500   1.90758796100042
chr1_14501_14550   4.02713013988978
chr1_14551_14600   6.14667231877914
chr1_14601_14650   8.2662144976685
chr1_14651_14700   10.3857566765579
chr1_14701_14750   12.5052988554472
chr1_14751_14800   14.6248410343366
chr1_14801_14850   16.7443832132259
chr1_14851_14900   18.8639253921153

My percentages are in double,so it needs to be rounded off to the nearest and then accordingly calculate. How can I do this in awk?

o/p

0-10 5
11-20 5
21-30 0
31-40 0

so on until
90-100% 0

Thanks,
# 2  
Old 08-04-2011
Hello,

Per our forum rules, all threads must have a descriptive subject text. For example, do not post questions with subjects like "Help Me!", "Urgent!!" or "Doubt". Post subjects like "Execution Problems with Cron" or "Help with Backup Shell Script".

The reason for this is that nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, the subject field must be something useful and related to the problem!

In addition, current forum users who are kind enough to answer questions should be able to understand the essence of your query at first glance.

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your subject text. You might receive a forum infraction if you don't pay attention to this.

Thank you.

The UNIX and Linux Forumso
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Doubt

in my shell script requirement is to search and replace the file with variable so i use the following command sed -i "s/abc/$SCHEMA/g" table.sql later when the script runs sqlplus username/pwd@Table& this & is not letting the variable to replace the value inside the file .please let me know... (1 Reply)
Discussion started by: bhuvan1
1 Replies

2. Shell Programming and Scripting

Doubt..

Hi experts, In one of our code we have used some command like this. name=${name##*/} Can someone please let me know what exactly it does? Thanks & Regards, Sathya V. (1 Reply)
Discussion started by: Sathya83aa
1 Replies

3. Red Hat

Doubt

How to create a file with specific size in RHEL6 (1 Reply)
Discussion started by: Sashi Kanth A
1 Replies

4. Ubuntu

Doubt

hi ,, i am new for this.. i want to know abt linux os.. which version is best for it industry.. please suggest me..:cool: (1 Reply)
Discussion started by: c vignesh kumar
1 Replies

5. UNIX for Dummies Questions & Answers

Doubt

Hi , Struck with one basic question. Iam expecting word count of 4 where "wc" is showing as 5 . # echo "abcd" | wc 1 1 5 # echo abcd | wc 1 1 5 (5 Replies)
Discussion started by: penchal_boddu
5 Replies

6. UNIX for Advanced & Expert Users

doubt in df -h

in my parition i hav parition like this Filesystem Size Used Avail Use% Mounted on /dev/sda2 24G 22G 756M 97% / /dev/sda5 248G 1.2G 234G 1% /else /dev/sda1 965M 24M 892M 3% /boot tmpfs 7.0G 0 7.0G 0%... (1 Reply)
Discussion started by: ponmuthu
1 Replies

7. Shell Programming and Scripting

One doubt

Hi, Can i use the shell script like this? When i am running the script it is hanging not giving me any output. I can redirect the output and then i can do the manipulations also but why this one is wrong. I am confused we can do like this or not.. #!/usr/bin/ksh for line in `top` do... (2 Replies)
Discussion started by: namishtiwari
2 Replies
Login or Register to Ask a Question