Ancient sort version?
Linda
haniganwork at earthlink.net
Tue Aug 6 17:20:48 UTC 2013
On 08/06/2013 03:37 AM, Colin Watson wrote:
> On Mon, Aug 05, 2013 at 04:10:02PM -0500, Linda wrote:
>> So where I do a system call in a c++ program of sort -t^ +11 -10 +2
>> -6 that actually is no longer the correct way to do it and I should
>> start figuring out how to use -k instead?
> That's the historical pre-POSIX notation. I believe the equivalent
> POSIX notation is:
>
> sort -t^ -k12,11 -k3,7
>
> ... except that I haven't tested that, and have no idea what it might
> mean for POS1 (11) to be greater than POS2 (10) - is this real code or
> just an example?
>
> You might also consider using C++'s native sorting facilities rather
> than forking an external process.
>
Sorry I switched the 11 and 10 in the code. The first
programs I wrote years ago were bash shell scripts with AT&T
Unix System V and when I started using C++ I had a few files
that needed a temp file created with a different order from
the original. Since I'd been using sort to create the files
when I manipulated them by hand, I just did the same thing
with a system call. Over the years there was no reason to
change the code so it is still there.
Linda
More information about the ubuntu-users
mailing list