Can anyone recommend a quick and dirty way to sort a device list? For example, 
if I do this:

ls /dev/ad* | sort

I get something like this:

/dev/ad10
/dev/ad4
/dev/ad6
/dev/ad8

I can add -g, but it doesn't help:

ls /dev/ad* | sort -g

/dev/ad10
/dev/ad4
/dev/ad6
/dev/ad8

I need to skip the device prefix before applying the -g option. Something like 
this works:

ls /dev/ad*|sort -g -k 1.8

/dev/ad4
/dev/ad6
/dev/ad8
/dev/ad10

but this assumes the device name is just two characters long. I want a quick 
way to sort a generic device list like this, considering only the numeric part 
of the device for the key. Is there a quick and dirty way to do this or do I 
need to pipe it into a perl script or something?

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[email protected]"

Reply via email to