Skip to content

Instantly share code, notes, and snippets.

@Tomasz-Silpion
Created February 7, 2017 00:59
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 Tomasz-Silpion/a0b76d76880830d1ec937eac40d29aed to your computer and use it in GitHub Desktop.
Save Tomasz-Silpion/a0b76d76880830d1ec937eac40d29aed to your computer and use it in GitHub Desktop.
Script for parsing Google PageSpeed optimized content MANIFEST
# Script for parsing Google PageSpeed optimized content MANIFEST
# Copyright (C) 2016 Tomasz Silpion Gregorczyk - All Rights Reserved
file="MANIFEST"
while IFS= read line
do
#strip file paths
IFS=':' read -r src protocol url <<EOF
$line
EOF
#remove protocol double slash left in url
path=`echo $url | sed 's/\/\///'`
if test -n "$path"; then
mkdir -p -- "${path%/*}" && touch -- "$path"
cp $src $path
fi
done <"$file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment