"P.V.Anthony" <[EMAIL PROTECTED]> posted [EMAIL PROTECTED], 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
