i'd like someone to explain me the meaning of the code below:
sort -t: +0 -1 /etc/passwd
when i'm running this at terminal it prints me all the contents of /etc/passwd file.
maybe it sorts them by the first collumn?
i'd like someone to explain me the meaning of the code below:
sort -t: +0 -1 /etc/passwd
when i'm running this at terminal it prints me all the contents of /etc/passwd file.
maybe it sorts them by the first collumn?
Hello,
man sort should give you the information.
-tx Use x as the field delimiter (replace x with a comma or other character).
Regards
I don't think that these parameters to "sort" do anything useful. The +/- syntax has been pretty much replaced with "-k" key postion parameters nowadays.
Where did you find these parameters to "sort"? What sorted order do you need?
Hi.
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.
excerpt from info coreutils sort
For:
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0.8 (lenny)
sort (GNU coreutils) 6.10
Best wishes ... cheers, drl
sort -t: +0 -1 /etc/passwd
This "sort" command confines the sort key to the whole of the first field (numbered from zero) up to the first colon.
Managed to find a passwd file where it made a difference from just using "sort -t:".
If you have usernames such as "fred" "freda" "fred2" "fred3" then they are properly sorted to order.