I have a file with full of file routes and timestamps.
xxxx/view/css/animate.css/3.1.1/animate.min.css: 1494509091
xxxx/view/fonts/cinzel/fonts.css: 1494509091
xxxx/view/fonts/garamondcondot-book/fonts.css: 1494509092
xxxx/view/fonts/gotham-narrow/fonts.css: 1494509092
xxxx/view/fonts/gotham/fonts.css: 1494509092
xxxx/view/fonts/greatvibes/fonts.css: 1494509092
xxxx/view/fonts/indie-flower/fonts.css: 1494509092
xxxx/view/fonts/katibeh/fonts.css: 1494509092
xxxx/view/fonts/lobster-two/fonts.css: 1494509092
xxxx/view/fonts/museo/fonts.css: 1494509092
xxxx/view/fonts/myriad-pro/fonts.css: 1494509092
These timestamps isn't right, so i need to check with git log the right last editied timestamp, with this command:
git log -1 --pretty="format:%ct" xxxx/view/css/animate.css/3.1.1/animate.min.css
The problem is that i have more than 500-600 files to check and replace the correct timestamp. I tried with awk, sed but is not good. Here is my examples:
variables=$(git log -1 --pretty="format:%ct")
while read line ; do
replacement="$variables $line"
sed 's/,.*:/ $replacement/' <<< "$line"
done < files.yml
another:
file="files2.yml"
files=$(cat files.yml | awk '{print $1}' | cut -d ':' -f 1)
for i in $files;do
new=$(git log -1 --pretty="format:%ct" $i)
sed "s/ .*:/ $new/" files2.yml
done
Have you any tips?