![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing root group to group from other | mjkroner | SUN Solaris | 4 | 03-05-2009 04:25 AM |
| retrieving all group names with a given group number | Andrewkl | UNIX for Advanced & Expert Users | 3 | 10-25-2008 04:07 AM |
| Monkcast #12: IBM HW group OEMs Solaris to chagrin of SW group & a ... - ZDNet.com bl | iBot | UNIX and Linux RSS News | 0 | 08-17-2007 04:30 PM |
| entry in /etc/group too long - problem using sudo with %group | poli | SUN Solaris | 4 | 12-21-2004 09:50 AM |
| NIS group vs local group | vjsony | UNIX for Dummies Questions & Answers | 3 | 05-19-2003 09:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
Without seeing the data, I can only simulate. Perhaps the following example will help illustrate:
sample file Code:
> cat file99 joe:1:alpha:4:5 jim:4:beta:16:9 bette:2:comma:99:0 dennis:3:per:12:12 harry:2:comma:12:13 olivia:1:beta:4:4 Code:
> sort -t: -k3 -k2 file99 joe:1:alpha:4:5 jim:4:beta:16:9 olivia:1:beta:4:4 harry:2:comma:12:13 bette:2:comma:99:0 dennis:3:per:12:12 Code:
> sort -t: -k3.1,3.3 -k2 file99 joe:1:alpha:4:5 olivia:1:beta:4:4 jim:4:beta:16:9 harry:2:comma:12:13 bette:2:comma:99:0 dennis:3:per:12:12 |
|
|||||
|
i tried doing a sort using explicit definition as suggested on a couple of fields but again i could not get it to come out right.
I think i don't understand enough about how sort actually works: when i specify certain fields to sort on, what does it do sorting-wise with the fields i have not specified? I'm beginning to think it's also sorting on a field i have not specified and that is why it is messing up the grouping. |
|
|||||
|
Code:
Data records deleted I hope that makes some sort of sense.... Last edited by RacerX; 10-16-2008 at 07:41 AM.. Reason: solved |
|
|||||
|
Sort is normally alphabetic - thus a field with a 12 will be before a 2 or 3. You will need the 'n' option on the field to make numeric.
To help determine where your script has gone astray, I would suggest you verify that your logic is fine for just one key. Then, add a second key; and so on until you discover the problem. And from more investigation, I do not see any records improperly sorted. Code:
> sort file200 -k3n -k4.1,4.3 -k9.1,9.10 -k29n -k8.1,8.2 -k28.1,28.10 | cut -d":" -f2-4,8-9,28-29
{data records here --- removed once issue solved --- not part of issue}
>
Last edited by joeyg; 10-16-2008 at 08:39 AM.. Reason: Added sample output from a test |
|
|||||
|
Quote:
Quote:
Anyhow, thanks for all your help, you steered me to a solution. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|