Re: OT - Bourne shell array sort

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tod wrote:
Without having to write my own, is there a quick way I can sort a two dimensional array on a specific column? Of course if there's a list that might be better to post this question to I'd appreciate that as well.


Thanks - Tod



Ok, poorly formed question.  I know about sort, the -k option was the
first thing I thought of.

Here's an example:

#!/bin/sh

SONGS=`find /mnt/music -type f`


I know at a certain position in the directory structure there is an artist, a song, a title, and an album name. I could use -k along with -t to specify a sort on delimiter like:

SONGS=`find /mnt/music -type f |sort -t '/' -k 5,5`

What I was wondering is if I could do this against the SONG array on the fly, or if I needed to rerun the find, pumping it through sort with different parameters each time. I'm sure there's a better way but I'm blind to it at the moment.

Sorry for bad post, just looking for a quick answer from a large experience base. Thanks for the feedback.

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux