Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: sort error
Date: Fri, 10 Oct 2008 20:45:47
Message-Id: pan.2008.10.10.20.45.33@cox.net
In Reply to: [gentoo-amd64] sort error by "P.V.Anthony"
1 "P.V.Anthony" <pvantony@×××××××××××.sg> posted
2 48EFAFF7.2050708@×××××××××××.sg, excerpted below, on Sat, 11 Oct 2008
3 03:41:43 +0800:
4
5 > Hi,
6 >
7 > I am having a problem doing a simple sort. The sorting just does not
8 > work with the command sort.
9 >
10 > In a directory are the following files,
11 >
12 > access.log.0
13 > access.log.1
14 > access.log.10
15 > access.log.11
16 > access.log.12
17 > access.log.13
18 > access.log.14
19 > access.log.15
20 > access.log.16
21 > access.log.17
22 > access.log.18
23 > access.log.19
24 > access.log.2
25 > access.log.20
26 > access.log.21
27 > access.log.3
28 > access.log.4
29 > access.log.5
30 > access.log.6
31 > access.log.7
32 > access.log.8
33 > access.log.9
34 >
35 > Did the following command,
36 >
37 > #ls access.log.* | sort -n +0.11
38 >
39 > Got the following error,
40 > #sort: open failed: +0.11: No such file or directory
41 >
42 > What am I doing wrong?
43 >
44 > Tried puting the list of files into a file called "testing" then did the
45 > following command,
46 > #sort -n +0.11 testing
47 >
48 > Still same error,
49 > #sort: open failed: +0.11: No such file or directory
50 >
51 > How to correct this?
52
53 You're using an obsolete (and ambiguous) syntax. I discovered this by
54 first reading the manpage, which didn't mention that syntax (but did
55 mention the -k option, the newer syntax), but /did/ mention that for
56 complete documentation refer to the info page coreutils "sort
57 invocation", which I did. That confirmed what I has already suspected,
58 that you were using an obsolete syntax, with an explanation of why it's
59 obsolete (it's ambiguous, the other reading being how it interprets it
60 now, as a filename) and instructions for getting the old behavior if
61 still desired, tho it's now discouraged.
62
63 So either check the manpage and use -k and an origin-1 sort key instead,
64 or follow thru to the info page and read up on how to get it to interpret
65 the obsolete origin-0 sort key you are trying to feed it.
66
67 --
68 Duncan - List replies preferred. No HTML msgs.
69 "Every nonfree program has a lord, a master --
70 and if you use the program, he is your master." Richard Stallman

Replies

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