Tag Info

New answers tagged

1

For displaying the current directory bash keeps some internal state that doesn't necessarily corresponds to the actual (shortest) path to the current directory. This helps in keeping the path if you cd through soft links. The cd // (but also when doing e.g. cd //tmp) do not seem to trigger a sanitization of the internal path displayed by pwd, but more than ...


13

Izkata's comment revealed the answer: locale-specific comparisons. The sort command uses the locale indicated by the environment, whereas Python defaults to a byte order comparison. Comparing UTF-8 strings is harder than comparing byte strings. $ time (LC_ALL=C sort <numbers.txt >s2.txt) real 0m5.485s user 0m14.028s sys 0m0.404s How about ...


7

This is more of an extra analysis than an actual answer but it does seem to vary depending on the data being sorted. First, a base reading: $ printf "%s\n" {1..1000000} > numbers.txt $ time python sort.py <numbers.txt >s1.txt real 0m0.521s user 0m0.216s sys 0m0.100s $ time sort <numbers.txt >s2.txt real 0m3.708s user ...


4

Both of the implementations are in C, so a level playing field there. Coreutils sort apparently uses the mergesort algorithm. Mergesort does a fixed number of comparisons which increases logarithmically to the input size, i.e. big O(n log n). Python's sort uses a unique hybrid merge/insertion sort, timsort, which will do a variable number of comparisons ...


2

The authoritative source would be http://www.gnu.org/software/software.html from the Free Software Foundation rather than the Wiki page cited in the accepted answer. On that page grep is listed as a separate piece of software.


2

Check again the link you posted, there's a commit message: date: support parsing of ISO-8601-with-"T" dates It was implemented in coreutils 8.13 (see changelog).


1

From a look at the man page, it seems that install will not do what you want. Indeed, the Synopsis section indicates a usage of the form: install [OPTION]... -d DIRECTORY... and later on, the man page says: -d, --directory treat all arguments as directory names; create all components of the specified directories So it seems ...



Top 50 recent answers are included