#!/bin/sh -e for rss_tracked_dir in ~/.config/automedia/rss/tracked/*; do cat "$rss_tracked_dir/updated" echo " " $(basename "$rss_tracked_dir") done | sort -nr | while IFS= read -r line; do timestamp=$(date -d @$(echo "$line" | cut -d' ' -f1)) rss_tracked_item=$(echo "$line" | cut -d' ' -f2-) echo "$timestamp" "|" "$rss_tracked_item" done