Gentoo Archives: gentoo-amd64

From: Paul Hartman <paul.hartman+gentoo@×××××.com>
To: gentoo-amd64@l.g.o
Subject: Re: [gentoo-amd64] sort error
Date: Fri, 10 Oct 2008 20:14:27
Message-Id: 58965d8a0810101314q1ef78d10ib4064affe9ba390c@mail.gmail.com
In Reply to: Re: [gentoo-amd64] sort error by Paul Hartman
1 On Fri, Oct 10, 2008 at 3:05 PM, Paul Hartman
2 <paul.hartman+gentoo@×××××.com> wrote:
3 > On Fri, Oct 10, 2008 at 2:41 PM, P.V.Anthony <pvantony@×××××××××××.sg> wrote:
4 >> Hi,
5 >>
6 >> I am having a problem doing a simple sort. The sorting just does not
7 >> work with the command sort.
8 >>
9 >> In a directory are the following files,
10 >>
11 >> access.log.0
12 >> access.log.1
13 >> access.log.10
14 >> access.log.11
15 >> access.log.12
16 >> access.log.13
17 >> access.log.14
18 >> access.log.15
19 >> access.log.16
20 >> access.log.17
21 >> access.log.18
22 >> access.log.19
23 >> access.log.2
24 >> access.log.20
25 >> access.log.21
26 >> access.log.3
27 >> access.log.4
28 >> access.log.5
29 >> access.log.6
30 >> access.log.7
31 >> access.log.8
32 >> access.log.9
33 >>
34 >> Did the following command,
35 >>
36 >> #ls access.log.* | sort -n +0.11
37 >>
38 >> Got the following error,
39 >> #sort: open failed: +0.11: No such file or directory
40 >>
41 >> What am I doing wrong?
42 >>
43 >> Tried puting the list of files into a file called "testing" then did the
44 >> following command,
45 >> #sort -n +0.11 testing
46 >>
47 >> Still same error,
48 >> #sort: open failed: +0.11: No such file or directory
49 >>
50 >> How to correct this?
51 >
52
53 I found your solution by reading the manual. The syntax you use is obsolete:
54
55 "On older systems, `sort' supports an obsolete origin-zero syntax
56 `+POS1 [-POS2]' for specifying sort keys. This obsolete behavior can
57 be enabled or disabled with the `_POSIX2_VERSION' environment variable
58 (*note Standards conformance::); it can also be enabled when
59 `POSIXLY_CORRECT' is not set by using the obsolete syntax with `-POS2'
60 present."
61
62 After setting that environment variable, it works as you expected.
63
64 _POSIX2_VERSION=1 sort -n +0.11 testing
65
66 Thanks,
67 Paul

Replies

Subject Author
Re: [gentoo-amd64] sort error "P.V.Anthony" <pvantony@×××××××××××.sg>