Greetings, this is a question about a possible new command-line option for sort that I'd be interested in implementing, but I thought I'd throw the idea out there first before spending time on an idea that was not going to be considered useful. I can't think of how I'd do this other than the way I've put together below as an example of an existing workaround.
When using sort to look at space-delimited data (ie with human-readable columns) with a header row (or rows) it's useful to be able to keep the header rows at the top/bottom of the data rather than having them end up mixed with the data after sorting. It's often possible to do this by looking at the data twice (once to grab the header, once to sort) - either by dumping to a file or by running the generating command twice. For example - take some_command which outputs space-delimeted data with 1 header row and a fourth numeric column I'd like to sort on: some_command > templog; head -1 templog; tail -n +2 templog | sort -n -k 4 I think it would frequently be handy to be able to just ask sort to keep the header rows aside - especially when doing things like running the sort inside a "watch" loop where you'd like to be able to come back to it over time and see what each column is. Cheerio, Brad -- Bradley Dean Email: [email protected] Skype: [email protected] Mobile(Aus): +61-413014395 WWW: http://bjdean.id.au/
