Originally Posted by fezzie
I have done it as follows:
grep [:10-13:] < usernames | tee /usernames2 | sort -g > /badusers
I'm guessing (by the colons) that usernames is in the same format as /etc/passwd:
It looks like you are sending output to files in the root directory (/), which is a problem since only the root user will be able to run this.
This will list users 10-13,
That grep command will actually list all
users; square brackets  indicate a character class
so any line with one of ':','1','0', or '3' will match.
Regular expressions (and therefore grep) don't support numeric ranges.
but to list their names would you use 'join'?
You could use cut
to extract the username.