Introduction
Introduction Statistics Contact Development Disclaimer Help
sfeed_update: merge: change the default to use the last record - sfeed - RSS an…
git clone git://git.codemadness.org/sfeed
Log
Files
Refs
README
LICENSE
---
commit e77e0165d3151ebe763a602adaa486af2467e6df
parent 66c4192ad01bc01c65491f30f746cce00a5dab8d
Author: Hiltjo Posthuma <[email protected]>
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(-)
---
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).
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.