Sponsored Content
Top Forums Shell Programming and Scripting Resume and count repeated values Post 302769677 by jiam912 on Wednesday 13th of February 2013 04:55:04 AM
Old 02-13-2013
Your help is really appreciated .. Thanks a lot

---------- Post updated at 04:05 AM ---------- Previous update was at 03:50 AM ----------

Hi rdtrx1,

How I can print other column using your script ( string value ).. I try to modify myself ,, but I got value 0,, in the colum Smilie.. I try to use printf instead of print ..but it doesn't work...

Code:
 for (i in a) print i, mn[i], mx[i], b[i], c[i];

Input file
Code:
1050    , 9    ,9888    ,N8        
1050    ,10    ,9888    ,N8        
1050    ,11    ,9888    ,N8        
1050    ,12    ,9888    ,N8        
1050    ,13    ,9888    ,N8        
1051    , 9    ,9889    ,N8        
1051    ,10    ,9889    ,N8        
1051    ,11    ,9889    ,N8        
1051    ,12    ,9889    ,N8        
1052    , 9    ,9890    ,N8        
1052    ,10    ,9890    ,N8        
1052    ,11    ,9890    ,N8        
1052    ,12    ,9890    ,N8        
1053    , 9    ,9891    ,N8        
1053    ,10    ,9891    ,N8        
1053    ,11    ,9891    ,N8        
1054    , 9    ,9892    ,N8        
1054    ,10    ,9892    ,N8        
1054    ,11    ,9892    ,N8

output file desired..

Code:
1050    9  15    9888   N8  5 
1051    9  18    9889   N8  4 
1052    9  15    9890   N8  4 
1053    9  14    9891   N8  4 
1054    9  11    9892   N8  3

Thanks for your help

---------- Post updated at 04:55 AM ---------- Previous update was at 04:05 AM ----------

I try like it... but it doesn't work Smilie

Code:
awk '                                                                                     
{for (i=1; i<=NF; i++) $i=$i+0;                                                           
 if (!a[$1]) mx[$1]=mn[$1]=$2;                                                            
 a[$1]=$1; b[$1]=$3; d[$1]=$4; c[$1]++;                                                   
 if ($2<mn[$1]) mn[$1]=$2;                                                                
 if ($2>mx[$1]) mx[$1]=$2;                                                                
}                                                                                         
END {                                                                                     
  for (i in a) print i, mn[i], mx[i], b[i], d[i], c[i];                                   
# for (i in a) printf i ("%10d,%10d,%10d,%10d,%10s\n", mn[i], mx[i], b[i], d[i], c[i];    
}                                                                                         
' FS="," OFS="\t" tmp10

 

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

Are companies viewing my resume? How do I track my resume visits?

Hi everybody, I am wondering if there is any tool or website out there which can track who is viewing my resume. It is very frustrating when you send your CV or Cover Letter and you receive no feedback from the company, you don't even know if they have checked it out. Thanks for your help (1 Reply)
Discussion started by: gearyipswich
1 Replies

2. Programming

Count the number of repeated characters in a given string

i have a string "dfasdfasdfadf" i want to count the number of times each character is repeated.. For instance, d is repeated 4 times, f is repeated 4 times.. can u give a program in c (1 Reply)
Discussion started by: pgmfourms
1 Replies

3. Shell Programming and Scripting

To Delete the repeated occurances and print in same line by appending values

Hi All, I am trying to work on below text a b c 1 a b c 2 a b c 3 x y z 6 x y z 44 a b c 89 Need to delete the occurances and get in single line like below: a b c 1 2 3 89 x y z 6 44 89 Please help me i am new into unix scripting ..... ---------- Post updated at 03:00... (8 Replies)
Discussion started by: shaliniyadav
8 Replies

4. Shell Programming and Scripting

comparing the values of repeated keys in multiple columns

Hi Guyz The 1st column of the input file has repeated keys like x,y and z. The ist task is if the 1st column has unique key (say x) and then need to consider 4th column, if it is + symbol then subtract 2nd column value with 3rd column value (we will get 2(10-8)) or if it is - symbol subtract 3rd... (3 Replies)
Discussion started by: repinementer
3 Replies

5. Hardware

Cannot resume from suspend with new motherboardktop, does not resume properly

I would like to get pm-suspend (or any other suspend method) working for a small new desktop computer. It is based on a Zotac GF-8200 ITX motherboard and an AMD Athlon II X@ 240 CPU using ArchLinux x86_64. The pm-suspend script works, apparently putting the machine into suspend correctly... (0 Replies)
Discussion started by: lagagnon
0 Replies

6. Shell Programming and Scripting

Help in counting the no of repeated words with count in a file

Hi Pls help in solving my doubt.Iam having file like below file1.txt priya jenny jenny priya raj radhika priya bharti bharti Output required: I need a output like count of repeated words with name for ex: priya 3 jenny 2 (4 Replies)
Discussion started by: bha148
4 Replies

7. UNIX for Dummies Questions & Answers

Extracting column if above certain values and repeated over a number of times continuously

Hi I am new to the forum and would like to ask: i have a file in form with thousands of column id.1 A01 A01 A68 A68 id.2 A5 A5 A3 A3 1001 0 0 0.136 0.136 1002 0 0 0.262 0.183 1003 0 0 0.662 0.662 1004 0 0 ... (9 Replies)
Discussion started by: newbeeuk
9 Replies

8. Shell Programming and Scripting

Finding most repeated entry in a column and giving the count

Please can you help in providing the most repeated entry in the 2nd column and give its count Here is an input file 1, This , is a forum 2, This , is a forum 1, There , is a forum 2, This , is not right Here the most repeated entry is "This" and count is 3 So output... (4 Replies)
Discussion started by: necro98
4 Replies

9. Shell Programming and Scripting

Put repeated values into a table

Hi all, I have blocks of records like the following, each block ends in = in a new line, I want tabularize the entire output. The pattern is the same in every block although not all types are there in every block. For example gine3 is absent in the second block but present first and third. ... (7 Replies)
Discussion started by: ritakadm
7 Replies

10. Shell Programming and Scripting

Adding the values of repeated ids

File1 consist two columns, first some weired ids and second the numbers t|v203.1@t|k88711.1 0.1 t|v190.1@t|k90369.1 0.01 t|v203.1@t|k88711.1 0.5 t|v322.1@t|k88711.1 0.2 t|v207.1@t|k90369.1 0.11 t|v326.1@t|k85939.1 0.5 t|v207.1@t|k90369.1 0.7 t|v207.1@t|k90369.1 0.3 t|v326.1@t|k89421.1 0.33... (3 Replies)
Discussion started by: ashmit99
3 Replies
All times are GMT -4. The time now is 10:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy