awk finding counting sequence


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk finding counting sequence
Prev   Next
# 1  
Old 10-27-2011
awk finding counting sequence

Can awk count numbers until it reaches the end of the sequence after the slash?

input:
HTML Code:
serv1a, 32, 41/47, 53, 89/100, 108/11, 113.
serv1b, 1/2, 114/18, 121/35, 139/40, 143/55, 159/64,
serv2, 255/56, 274/77, 763, 774/75, 777, 1434/35, 1444/50, 1715, 2025/31, 2048.
serv10b, 804, 808, 929/32, 940/42, 977/1020, 1240/41, 1246, 1254/56, 1353, 1377/82.
serv11, 492/538, 674/75, 927/281, 403/06, 1444/50, 1510/19, 1530/37, 1613/18, 1621/23.
serv1a, 255/56, 274/77, 763, 774/75, 777, 1434/35, 1444/50, 1715, 2025/31, 2048.
serv3, 804, 808, 929/32, 940/42, 977/1020, 1240/41, 1246, 1254/56, 1353, 1377/82.
serv4b, 492/538, 674/75, 927/28, 483/87, 492/538, 674/75, 681/85, 689/90, 704/11 762,.
serv5, 1044/47, 483/87, 492/538, 674/75, 681/85, 689/90, 704/11.
serv6, 39/40, 54/55, 80, 82/85, 123/24, 256, 264/70, 275/76, 332/67, 369/80, 401/04. 
serv8, 1044/47, 483/87, 492/538, 674/75, 681/85, 689/90, 704/11 762, 810, 839, 927/28.
serv9a, 255/56, 274/77, 763, 774/75, 777, 1434/35, 1444/50, 1715, 2025/31, 2048.
output
HTML Code:
serv1a, 32, 41, 42, 43, 44, 45, 46, 47, 53, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 108, 109, 110, 111, 113.
serv1b, 1, 2, 114, 115, 116, 117, 118, 121, 122, 123, 124, 125, 126, 127.....
serv2, 255, 256, 274, 275, 276, 277, 763, 774, 775, 777, 1434, , 1435, 1444, 1450, 1715, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2048.
...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sequence of conditions awk

hello gurus, I want to use an associative array from a file to populate a field of another file, by matching several columns in order of priority. If the first column matches, then i dont want to match $2. Similarly I only want to match $3 when $1 and $2 are not in associative array. For the... (6 Replies)
Discussion started by: ritakadm
6 Replies

2. UNIX for Dummies Questions & Answers

awk code to reconstruct sequence from alignment

Hi Everyone, I need some help to construct a long 'Sbjct' string from the following input using incremental order of 'Sbjct' starting number (e.g. 26325115,33716368,33769033,34869860 etc.) Different 'Sbject' string will be separated by 'NNNN's as: ... (6 Replies)
Discussion started by: Fahmida
6 Replies

3. Shell Programming and Scripting

awk counting question

Probably a simple to this, but unsure how to do it. I would prefer an AWK solution. Below is the data set. 1 2 3 2 5 7 4 6 9 1 5 4 8 5 7 1 1 10 15 3 12 3 7 9 9 8 10 4 5 2 9 1 10 4 7 9 7 12 6 9 13 8 For the second... (11 Replies)
Discussion started by: mollydog11
11 Replies

4. Shell Programming and Scripting

Counting Fields with awk

ok, so a user can specify options as is shown below: ExA: cpu.pl!23!25!-allow or ExB: cpu.pl!23!25!-block!all options are delimited by the exclamation mark. now, in example A, there are 4 options provided by the user. in example B, there are 5 options provided by the user. ... (3 Replies)
Discussion started by: SkySmart
3 Replies

5. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

6. Shell Programming and Scripting

counting using awk

Hi, I want to perform a task using shell script. I am new to awk programming and any help would be greatly appreciated. I have the following 3 files (for example) file1: Name count Symbol chr1_1_50 10 XXXX chr3_101_150 30 YYYY File2: Name ... (13 Replies)
Discussion started by: Diya123
13 Replies

7. Shell Programming and Scripting

suffix a sequence in awk

hi I have a string pattern like ... ... 000446448742 00432265 040520100408 21974435 DEWSWATER GARRIER AAG IK4000 N 017500180000000000000000077000000000100 000446448742 00580937 040520100408 32083576 PEWSWATER BARRIER DAG GK4000 ... (6 Replies)
Discussion started by: zainravi
6 Replies

8. Shell Programming and Scripting

Counting with Awk

I need "awk solution" for simple counting! File looks like: STUDENT GRADE student1 A student2 A student3 B student4 A student5 B Desired Output: GRADE No.of Students A 3 B 2 Thanks for awking! (4 Replies)
Discussion started by: saint2006
4 Replies

9. Shell Programming and Scripting

Counting records with AWK

I've been working with an awk script and I'm wondeing id it's possible to count records in a file which DO NOT contain, in this instance fields 12 and 13. With the one script I am wanting to display the count for the records WITH fields 12 and 13 and a seperate count of records WITHOUT fields... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies

10. UNIX for Dummies Questions & Answers

how can i isolate the random sequence of numbers using awk?

as you can see there is a delimiter after c8 "::". Awk sees the rest as fields because it doesn't recognize spaces and tabs as delimiters. So i am basically looking to isolate 20030003ba13f6cc. Can anyone help? c8::20030003ba13f6cc disk connected configured unknown (2 Replies)
Discussion started by: rcon1
2 Replies
Login or Register to Ask a Question