scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

favsync (535B)


      1 #!/bin/sh
      2 
      3 FAVS={beauty.2f30.org:,drawn:,$HOME/}.xombrero/favorites
      4 
      5 # collect
      6 I=0
      7 for F in $FAVS
      8 do
      9     rsync -va $F /tmp/favorites.$I
     10     I=$(expr $I + 1)
     11 done
     12 
     13 # concat
     14 rm -f /tmp/favorites.cat
     15 for F in /tmp/favorites.[0-9]*
     16 do
     17     echo | cat $F - | grep -v '^$' >> /tmp/favorites.cat
     18 done
     19 
     20 # uniq
     21 NEWLINE='\
     22 '
     23 SEP='||'
     24 sed "$!N;s/\n/$SEP/" /tmp/favorites.cat | sort | uniq \
     25     | sed "s/$SEP/$NEWLINE/g" > /tmp/favorites.new
     26 
     27 # distribute
     28 for F in $FAVS
     29 do
     30     rsync -va /tmp/favorites.new $F
     31 done
     32 
     33 # clean
     34 rm -f /tmp/favorites.*