* [gentoo-amd64] sort error
@ 2008-10-10 19:41 P.V.Anthony
2008-10-10 19:52 ` Barry Schwartz
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: P.V.Anthony @ 2008-10-10 19:41 UTC (permalink / raw
To: gentoo-amd64
Hi,
I am having a problem doing a simple sort. The sorting just does not
work with the command sort.
In a directory are the following files,
access.log.0
access.log.1
access.log.10
access.log.11
access.log.12
access.log.13
access.log.14
access.log.15
access.log.16
access.log.17
access.log.18
access.log.19
access.log.2
access.log.20
access.log.21
access.log.3
access.log.4
access.log.5
access.log.6
access.log.7
access.log.8
access.log.9
Did the following command,
#ls access.log.* | sort -n +0.11
Got the following error,
#sort: open failed: +0.11: No such file or directory
What am I doing wrong?
Tried puting the list of files into a file called "testing" then did the
following command,
#sort -n +0.11 testing
Still same error,
#sort: open failed: +0.11: No such file or directory
How to correct this?
P.V.Anthony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-10 19:41 [gentoo-amd64] sort error P.V.Anthony
@ 2008-10-10 19:52 ` Barry Schwartz
2008-10-10 20:05 ` Paul Hartman
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Barry Schwartz @ 2008-10-10 19:52 UTC (permalink / raw
To: gentoo-amd64
"P.V.Anthony" <pvantony@singnet.com.sg> skribis:
> How to correct this?
"info coreutils sort" has examples. I'd have to RTFM myself to find
out how to do what you are trying, though. :)
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-10 19:41 [gentoo-amd64] sort error P.V.Anthony
2008-10-10 19:52 ` Barry Schwartz
@ 2008-10-10 20:05 ` Paul Hartman
2008-10-10 20:14 ` Paul Hartman
2008-10-10 20:45 ` [gentoo-amd64] " Duncan
2008-10-11 10:45 ` [gentoo-amd64] " Etaoin Shrdlu
3 siblings, 1 reply; 9+ messages in thread
From: Paul Hartman @ 2008-10-10 20:05 UTC (permalink / raw
To: gentoo-amd64
On Fri, Oct 10, 2008 at 2:41 PM, P.V.Anthony <pvantony@singnet.com.sg> wrote:
> Hi,
>
> I am having a problem doing a simple sort. The sorting just does not
> work with the command sort.
>
> In a directory are the following files,
>
> access.log.0
> access.log.1
> access.log.10
> access.log.11
> access.log.12
> access.log.13
> access.log.14
> access.log.15
> access.log.16
> access.log.17
> access.log.18
> access.log.19
> access.log.2
> access.log.20
> access.log.21
> access.log.3
> access.log.4
> access.log.5
> access.log.6
> access.log.7
> access.log.8
> access.log.9
>
> Did the following command,
>
> #ls access.log.* | sort -n +0.11
>
> Got the following error,
> #sort: open failed: +0.11: No such file or directory
>
> What am I doing wrong?
>
> Tried puting the list of files into a file called "testing" then did the
> following command,
> #sort -n +0.11 testing
>
> Still same error,
> #sort: open failed: +0.11: No such file or directory
>
> How to correct this?
Hi,
I just tried it on Windows (cygwin... I'm at work) and it worked as
expected. Maybe the + character needs to be escaped in your shell?
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-10 20:05 ` Paul Hartman
@ 2008-10-10 20:14 ` Paul Hartman
2008-10-11 15:16 ` P.V.Anthony
0 siblings, 1 reply; 9+ messages in thread
From: Paul Hartman @ 2008-10-10 20:14 UTC (permalink / raw
To: gentoo-amd64
On Fri, Oct 10, 2008 at 3:05 PM, Paul Hartman
<paul.hartman+gentoo@gmail.com> wrote:
> On Fri, Oct 10, 2008 at 2:41 PM, P.V.Anthony <pvantony@singnet.com.sg> wrote:
>> Hi,
>>
>> I am having a problem doing a simple sort. The sorting just does not
>> work with the command sort.
>>
>> In a directory are the following files,
>>
>> access.log.0
>> access.log.1
>> access.log.10
>> access.log.11
>> access.log.12
>> access.log.13
>> access.log.14
>> access.log.15
>> access.log.16
>> access.log.17
>> access.log.18
>> access.log.19
>> access.log.2
>> access.log.20
>> access.log.21
>> access.log.3
>> access.log.4
>> access.log.5
>> access.log.6
>> access.log.7
>> access.log.8
>> access.log.9
>>
>> Did the following command,
>>
>> #ls access.log.* | sort -n +0.11
>>
>> Got the following error,
>> #sort: open failed: +0.11: No such file or directory
>>
>> What am I doing wrong?
>>
>> Tried puting the list of files into a file called "testing" then did the
>> following command,
>> #sort -n +0.11 testing
>>
>> Still same error,
>> #sort: open failed: +0.11: No such file or directory
>>
>> How to correct this?
>
I found your solution by reading the manual. The syntax you use is obsolete:
"On older systems, `sort' supports an obsolete origin-zero syntax
`+POS1 [-POS2]' for specifying sort keys. This obsolete behavior can
be enabled or disabled with the `_POSIX2_VERSION' environment variable
(*note Standards conformance::); it can also be enabled when
`POSIXLY_CORRECT' is not set by using the obsolete syntax with `-POS2'
present."
After setting that environment variable, it works as you expected.
_POSIX2_VERSION=1 sort -n +0.11 testing
Thanks,
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [gentoo-amd64] Re: sort error
2008-10-10 19:41 [gentoo-amd64] sort error P.V.Anthony
2008-10-10 19:52 ` Barry Schwartz
2008-10-10 20:05 ` Paul Hartman
@ 2008-10-10 20:45 ` Duncan
2008-10-11 15:13 ` P.V.Anthony
2008-10-11 10:45 ` [gentoo-amd64] " Etaoin Shrdlu
3 siblings, 1 reply; 9+ messages in thread
From: Duncan @ 2008-10-10 20:45 UTC (permalink / raw
To: gentoo-amd64
"P.V.Anthony" <pvantony@singnet.com.sg> posted
48EFAFF7.2050708@singnet.com.sg, excerpted below, on Sat, 11 Oct 2008
03:41:43 +0800:
> Hi,
>
> I am having a problem doing a simple sort. The sorting just does not
> work with the command sort.
>
> In a directory are the following files,
>
> access.log.0
> access.log.1
> access.log.10
> access.log.11
> access.log.12
> access.log.13
> access.log.14
> access.log.15
> access.log.16
> access.log.17
> access.log.18
> access.log.19
> access.log.2
> access.log.20
> access.log.21
> access.log.3
> access.log.4
> access.log.5
> access.log.6
> access.log.7
> access.log.8
> access.log.9
>
> Did the following command,
>
> #ls access.log.* | sort -n +0.11
>
> Got the following error,
> #sort: open failed: +0.11: No such file or directory
>
> What am I doing wrong?
>
> Tried puting the list of files into a file called "testing" then did the
> following command,
> #sort -n +0.11 testing
>
> Still same error,
> #sort: open failed: +0.11: No such file or directory
>
> How to correct this?
You're using an obsolete (and ambiguous) syntax. I discovered this by
first reading the manpage, which didn't mention that syntax (but did
mention the -k option, the newer syntax), but /did/ mention that for
complete documentation refer to the info page coreutils "sort
invocation", which I did. That confirmed what I has already suspected,
that you were using an obsolete syntax, with an explanation of why it's
obsolete (it's ambiguous, the other reading being how it interprets it
now, as a filename) and instructions for getting the old behavior if
still desired, tho it's now discouraged.
So either check the manpage and use -k and an origin-1 sort key instead,
or follow thru to the info page and read up on how to get it to interpret
the obsolete origin-0 sort key you are trying to feed it.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-10 19:41 [gentoo-amd64] sort error P.V.Anthony
` (2 preceding siblings ...)
2008-10-10 20:45 ` [gentoo-amd64] " Duncan
@ 2008-10-11 10:45 ` Etaoin Shrdlu
2008-10-11 15:11 ` P.V.Anthony
3 siblings, 1 reply; 9+ messages in thread
From: Etaoin Shrdlu @ 2008-10-11 10:45 UTC (permalink / raw
To: gentoo-amd64
On Friday 10 October 2008, 21:41, P.V.Anthony wrote:
> Hi,
>
> I am having a problem doing a simple sort. The sorting just does not
> work with the command sort.
>
> In a directory are the following files,
>
> access.log.0
> access.log.1
> access.log.10
> access.log.11
> access.log.12
> access.log.13
> access.log.14
> access.log.15
> access.log.16
> access.log.17
> access.log.18
> access.log.19
> access.log.2
> access.log.20
> access.log.21
> access.log.3
> access.log.4
> access.log.5
> access.log.6
> access.log.7
> access.log.8
> access.log.9
>
> Did the following command,
>
> #ls access.log.* | sort -n +0.11
>
> Got the following error,
> #sort: open failed: +0.11: No such file or directory
ls access.log.* | sort -n -k1.12
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-11 10:45 ` [gentoo-amd64] " Etaoin Shrdlu
@ 2008-10-11 15:11 ` P.V.Anthony
0 siblings, 0 replies; 9+ messages in thread
From: P.V.Anthony @ 2008-10-11 15:11 UTC (permalink / raw
To: gentoo-amd64
Etaoin Shrdlu wrote:
> ls access.log.* | sort -n -k1.12
Works great. Thank you very much.
P.V.Anthony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] Re: sort error
2008-10-10 20:45 ` [gentoo-amd64] " Duncan
@ 2008-10-11 15:13 ` P.V.Anthony
0 siblings, 0 replies; 9+ messages in thread
From: P.V.Anthony @ 2008-10-11 15:13 UTC (permalink / raw
To: gentoo-amd64
Duncan wrote:
> You're using an obsolete (and ambiguous) syntax. I discovered this by
> first reading the manpage, which didn't mention that syntax (but did
> mention the -k option, the newer syntax), but /did/ mention that for
> complete documentation refer to the info page coreutils "sort
> invocation", which I did. That confirmed what I has already suspected,
> that you were using an obsolete syntax, with an explanation of why it's
> obsolete (it's ambiguous, the other reading being how it interprets it
> now, as a filename) and instructions for getting the old behavior if
> still desired, tho it's now discouraged.
>
> So either check the manpage and use -k and an origin-1 sort key instead,
> or follow thru to the info page and read up on how to get it to interpret
> the obsolete origin-0 sort key you are trying to feed it.
I did try the man pages and the info pages but I did not understand
them. I will read them again.
Thank you for the advice.
P.V.Anthony
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-amd64] sort error
2008-10-10 20:14 ` Paul Hartman
@ 2008-10-11 15:16 ` P.V.Anthony
0 siblings, 0 replies; 9+ messages in thread
From: P.V.Anthony @ 2008-10-11 15:16 UTC (permalink / raw
To: gentoo-amd64
Paul Hartman wrote:
> I found your solution by reading the manual. The syntax you use is obsolete:
>
> "On older systems, `sort' supports an obsolete origin-zero syntax
> `+POS1 [-POS2]' for specifying sort keys. This obsolete behavior can
> be enabled or disabled with the `_POSIX2_VERSION' environment variable
> (*note Standards conformance::); it can also be enabled when
> `POSIXLY_CORRECT' is not set by using the obsolete syntax with `-POS2'
> present."
>
> After setting that environment variable, it works as you expected.
>
> _POSIX2_VERSION=1 sort -n +0.11 testing
Thank you for sharing this version of the solution. Will remember that
this is an obsolete method.
Once again thank you all for sharing and helping me out.
P.V.Anthony
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-10-11 15:16 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-10 19:41 [gentoo-amd64] sort error P.V.Anthony
2008-10-10 19:52 ` Barry Schwartz
2008-10-10 20:05 ` Paul Hartman
2008-10-10 20:14 ` Paul Hartman
2008-10-11 15:16 ` P.V.Anthony
2008-10-10 20:45 ` [gentoo-amd64] " Duncan
2008-10-11 15:13 ` P.V.Anthony
2008-10-11 10:45 ` [gentoo-amd64] " Etaoin Shrdlu
2008-10-11 15:11 ` P.V.Anthony
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox