Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcenirm/51b346c87dd57274775d32fc2558d1d2 to your computer and use it in GitHub Desktop.
Save mcenirm/51b346c87dd57274775d32fc2558d1d2 to your computer and use it in GitHub Desktop.
Prepare the transferred-files log from `snowball cp` for easy comparison to `find . -type f -print`.
#!/bin/bash
set -e
set -u
Usage () { cat >&2 <<EOF
Usage: $0 < /tmp/snowball-xxx/transferred-files
Prepare the transferred-files log from 'snowball cp'
for easy comparison to 'find . -type f -print'.
(Reads from stdin and writes to stdout.)
EOF
}
if [ $# -gt 0 ] ; then
Usage
exit 1
fi
IFS=, read -a header
get_mountpoint_from_header () {
while [ $# -gt 0 ] ; do
case "$1" in
cp|--*)
shift
;;
*)
break
;;
esac
done
sed -e 's#%2F#/#g' <<<"$1"
}
mountpoint=$( get_mountpoint_from_header "${header[@]}" )
sed -e "s#^${mountpoint}#.#"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment