dotfiles

personal dotfiles
git clone anongit@rnpnr.xyz:dotfiles.git
Log | Files | Refs | Feed | Submodules

sfeed_clean (321B)


      1 #!/bin/sh
      2 
      3 # cleans up stale urls in ${SFEED_URL_FILE}
      4 
      5 files=$(find "${XDG_CACHE_HOME}/sfeed" -type f | grep -v "${SFEED_URL_FILE}")
      6 tmp=$(mktemp)
      7 awk -F '\t' '
      8 { url[$3] = 1 }
      9 END {
     10 	while ((getline < "'"${SFEED_URL_FILE}"'") > 0) {
     11 		if (url[$0])
     12 			print $0
     13 	}
     14 }' ${files} > "${tmp}"
     15 
     16 mv "${tmp}" "${SFEED_URL_FILE}"