INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Help parsing data in sets

Help parsing data in sets

(OP)
Wondering if anybody could help...

I've clipped some of the raw data, but you'll get the general idea.

Raw data:

CODE

CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-A 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-B 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-C 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-D 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-E 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-F 
CL1-G 
CL1-G 
CL1-G 
CL1-G 
CL1-G 
CL1-G 
CL1-H 
CL1-H 
CL1-H 
CL1-H 
CL1-H 
CL1-K 
CL1-K 
CL1-K 
CL1-L 
CL1-L 
CL1-M 
CL1-M 
CL1-N 
CL1-N 
CL1-N 
CL1-P 
CL2-A 
CL2-A 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-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 
CL4-K 

I want to count the occurences that each line repeats and compare it to the next iteration.


example output:

CODE

CL1-A 10 CL1-B 19 CL1-C 10 CL1-D 11 CL1-E 14 CL1-F 12 CL1-G 6 CL1-H 5 CL1-K 3 CL1-L 2 CL1-M 2 CL1-N 3 CL1-P 1
CL2-A 10 CL2-B 19 CL2-C 10 CL2-D 11 CL2-E 14 CL2-F 12 CL2-G 6 CL2-H 5 CL2-K 3 CL2-L 2 CL2-M 2 CL2-N 3 CL2-P 1

CL3-A 9 CL3-B 8 CL3-C 8 CL3-D 10 CL3-E 26 CL3-F 11 CL3-G 9 CL3-H 2 CL3-K 14 CL3-L 6 CL3-M 2 CL3-N 1 CL3-P 2
CL4-A 9 CL4-B 9 CL4-C 8 CL4-D 10 CL4-E 29 CL4-F 11 CL4-G 9 CL4-H 2 CL4-K 14 CL4-L 6 CL4-M 2 CL4-N 1 CL4-P 2

CL5-A 15 CL5-B 6 CL5-C 2 CL5-D 1 CL5-E 8 CL5-F 7 CL5-G 2 CL5-H 8 CL5-K 3 CL5-L 3 CL5-M 2 CL5-N 1 CL5-P 1
CL6-A 15 CL6-B 6 CL6-C 2 CL6-D 1 CL6-E 8 CL6-F 7 CL6-G 2 CL6-H 8 CL6-K 3 CL6-L 3 CL6-M 2 CL6-N 1 CL6-P 1

CL7-A 2 CL7-B 2 CL7-C 3 CL7-D 2 CL7-E 1 CL7-F 1 CL7-G 1 CL7-H 3 CL7-K 6 CL7-L 6 CL7-N 1 CL7-P 1 CL8-A 2
CL8-B 2 CL8-C 3 CL8-D 2 CL8-E 1 CL8-F 1 CL8-G 1 CL8-H 3 CL8-K 6 CL8-L 6 CL8-N 1 CL8-P 1 

You can see the first three sets line up nicely, so I can compare CL1-A to CL2-A, etc.. but the last section didn't line up.. CL7-A to CL8-B. It should be CL7-A to CL8-A.


Here's what I'm running:

CODE

COL_LENGTH=$(awk '{grp[$1]++}END{for (var in grp) print var, grp[var]}' ${data} | sort -2 -4 | awk '/A/{if(p)print NR-p-1;p=NR}'| awk 'NR==1{print $NF}')

awk '{grp[$1]++}
        END{for (var in grp) print var, grp[var]}' ${data}            | sort +1 | sort -n |  pr -a -t -s" " -c `expr ${ROWLENGTH} + 1` | awk '{print} !(NR % 2) {print ""}' 

Any suggestions would be appreciated. The number of occurences will very for each item.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close