On Thu, 2 Dec 2010, Josh Paetzel wrote: > On Thursday, December 02, 2010 10:20:47 am Daniel Taylor wrote: >> On 12/02/2010 12:03 AM, gregwm wrote: >>> how do you tell sort to ignore the first x characters of each line and >>> start the key at character x+1? >> >> That would be "sort -t'*' -k 1.9" if I understand it correctly. >> >> Replace '*' with something else if it might appear in the characters to >> be skipped. > > -t isn't needed in this case. sort -k 1.x, where x is the character > position you want to sort on, counting from 1. Right. I should have looked at "info sort" instead of "man sort" because the use of "." gets a lot more attention there. I forgot all about it. > You might want to check how it behaves if you have lines starting with > whitespace, that's the edge case that might blow it up. Another edge case > would be if you sort on character 4 and have a 3 character word followed by a > space. Not sure how it would react to that. I think sort -k1.x handles everything pretty well. Good to know. When there are initial spaces, it treats them as characters in the first field. When lines are shorter than x characters, they get sorted first (so "nothing" sorts before other characters). Spaces are handled like other characters. In short, it seems to do exactly what was requested. Mike