180 reputation
14
bio website
location
age
visits member for 1 year, 3 months
seen Apr 12 at 19:43

Mar
1
accepted How can I delete all unordered lines from a text file?
Feb
27
revised How can I delete all unordered lines from a text file?
edited to be case insensitive
Feb
27
comment How can I delete all unordered lines from a text file?
@HaukeLaging I think this is it (well, almost): ✔ Filters out all unordered elements (in both directions); ✔ is case insensitive (after a small tweak). I am still having some trouble with diacritics, though. awkjust doesn't seem to want to follow canon in how the letters are sorted. E.g.: sort will sort b c d a ä to a ä b c d but if given the latter as an input your snippet removes a. I can only assume that awk isn't registering the locale. It's strange though, because everything else does.
Feb
27
suggested suggested edit on How can I delete all unordered lines from a text file?
Feb
27
revised How can I delete all unordered lines from a text file?
edited to be locale dependent (in accordance with modified question body)
Feb
27
suggested suggested edit on How can I delete all unordered lines from a text file?
Feb
27
comment How can I delete all unordered lines from a text file?
@Grame: Thank you for this script. It works great with different cases and also performs well for different locales and their diacritics. However, it seems to suffer from the same sorting issue as Hauke's awk snippet. E.g: e f g a h i is truncated to e f h i when it should be e f g h i.
Feb
27
comment How can I delete all unordered lines from a text file?
Stephane is right. I am afraid I didn't look at the results thoroughly enough. This script works great if the unordered element in the list is lexicographically lower than the following ordered element (e.g.: j k z l m). OTOH, if the unordered element is lexicographically higher (e.g. e f g a h i) we see the behaviour Stephane pointed out.
Feb
27
comment How can I delete all unordered lines from a text file?
Ah, nervmind. The issue with diacritics was my fault. The first element in the example I linked to ("äpple") should have come after "apple". That's how diacritics are generally sorted in my locale. The issue with different cases remains, though. The items in my list are only sorted alphabetically and without regard to their capitalization. Would it be possible to make awk's sorting case insensitive as well?
Feb
27
comment How can I delete all unordered lines from a text file?
Thanks for your answer! This works great if all elements are lowercase and don't use any special diacritics (as shown in the examples). Unfortunately the phrases I am working with are both upper/lowercase and contain diacritics. This seems to mess the results up. Would it be possible to modify your script to work under these circumstances?
Feb
27
revised How can I delete all unordered lines from a text file?
some more information about the types of phrase we are dealing with
Feb
27
comment How can I delete all unordered lines from a text file?
@StephaneChazelas The decision would have to be made based on the group size. In this scenario ordered elements always come in groups of at least 2. Ccould only be the odd one out if there was an element before A.
Feb
27
comment How can I delete all unordered lines from a text file?
@terdon updated the question with better examples and more information. lgeorget: (concerning your first comment) No, that wouldn't work becase the unordered lines can be both higher and lower than the next element (see updated description).
Feb
27
revised How can I delete all unordered lines from a text file?
updated with better examples and more information
Feb
27
comment How can I delete all unordered lines from a text file?
@HaukeLaging You are right, I didn't consider this when constructing the example. The real case might be a bit easier to solve: It's always one unordered line at a time, so you would have a long list of ordered items (o) interspersed by very few single unordered items (u), e.g.: o-o-o-o-o-o-u-o-o-o-o-o-u-o-o-u. Would this make the problem more feasible to solve with command line tools?
Feb
27
asked How can I delete all unordered lines from a text file?
Feb
7
awarded  Popular Question
Nov
5
comment Are there any full featured pdf readers that integrate comment function?
@naught101 Oh, that's great! I must admit the last time I tried out the PDF annotation support in Okular it was just when it was released. I am happy to hear that so much progress has been made since then.
Nov
4
answered Are there any full featured pdf readers that integrate comment function?
Nov
4
comment Are there any full featured pdf readers that integrate comment function?
It should be noted, however, that the comment types are quite restricted and not much better than what evince offers (it's only highlighting and popup notes that can be exported to PDF, as far as I can remember).