Skip to content

Instantly share code, notes, and snippets.

@bradcordeiro
Last active May 9, 2018 21:13
Show Gist options
  • Save bradcordeiro/6838722816193a9e3c415cc569c2072f to your computer and use it in GitHub Desktop.
Save bradcordeiro/6838722816193a9e3c415cc569c2072f to your computer and use it in GitHub Desktop.
Use xmlstarlet, bash sort, and awk to sort files from an LTFS schema by position on tape and write it to a text file suitable for rsync's --files-from
xml sel -t -m ".//file" -v "extentinfo/extent[1]/startblock" -o ",\"" \
-v name -o "\",\"" -m "ancestor-or-self::directory" -v "name" -o "/" -b \
-o "\"" -n ${INPUT_FILE} | sort -n | awk -F',' '{gsub(/"/,"");print $3 $2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment