URI:
       sfeed_update: merge: change the default to use the last record - sfeed - RSS and Atom parser
  HTML git clone git://git.codemadness.org/sfeed
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit e77e0165d3151ebe763a602adaa486af2467e6df
   DIR parent 66c4192ad01bc01c65491f30f746cce00a5dab8d
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sat,  2 Aug 2025 14:06:01 +0200
       
       sfeed_update: merge: change the default to use the last record
       
       In many cases it makes sense to use the last record.
       
       Most implementations using sort -u use a stable sort and use the first record
       found by the specified key (where the key are the fields: id, title, link).
       
       This means it kept the record found in the old file and not update the last
       content.
       
       Swap the default to use the last record instead of the first.
       
       An alternative in awk:
       
       merge() {
               LC_ALL=C awk -F '\t' '!x[$6 "\t" $2 "\t" $3]++' "$3" "$2"
       }
       
       Thanks Ivo Cicchese for the feedback!
       
       Diffstat:
         M sfeed_update                        |       2 +-
       
       1 file changed, 1 insertion(+), 1 deletion(-)
       ---
   DIR diff --git a/sfeed_update b/sfeed_update
       @@ -79,7 +79,7 @@ filter() {
        # merge raw files: unique sort by id, title, link.
        # merge(name, oldfile, newfile)
        merge() {
       -        sort -t '        ' -u -k6,6 -k2,2 -k3,3 "$2" "$3" 2>/dev/null
       +        sort -t '        ' -u -k6,6 -k2,2 -k3,3 "$3" "$2" 2>/dev/null
        }
        
        # order by timestamp (descending).