Skip to content

Instantly share code, notes, and snippets.

@ashwanthkumar
Last active February 12, 2016 10:12
Show Gist options
  • Select an option

  • Save ashwanthkumar/6b475cb53e5e01832bbf to your computer and use it in GitHub Desktop.

Select an option

Save ashwanthkumar/6b475cb53e5e01832bbf to your computer and use it in GitHub Desktop.
#!/bin/bash
PACKER_LOG_FILE=$1
awk -F, '{if($2 != "") { print $0}}' $PACKER_LOG_FILE | while read LINE; do
BUILDER_NAME=$(echo $LINE | awk -F, '{print $2}')
if [ "X$BUILDER_NAME" != "X" ]; then
echo "found $BUILDER_NAME on $LINE"
fi
done
brindavan:~ ashwanthkumar$ time ./parse-packer packer.log
found hvm-builder on 1455261963,hvm-builder,artifact-count,1
found hvm-builder on 1455261964,hvm-builder,artifact,0,builder-id,mitchellh.amazonebs
found hvm-builder on 1455261964,hvm-builder,artifact,0,id,us-east-1:ami-abcd
found hvm-builder on 1455261964,hvm-builder,artifact,0,string,AMIs were created:nnus-east-1: ami-abcd
found hvm-builder on 1455261964,hvm-builder,artifact,0,files-count,0
found hvm-builder on 1455261964,hvm-builder,artifact,0,end
found pvm-builder on 1455261964,pvm-builder,artifact-count,1
found pvm-builder on 1455261964,pvm-builder,artifact,0,builder-id,mitchellh.amazonebs
found pvm-builder on 1455261964,pvm-builder,artifact,0,id,us-east-1:ami-efgh
found pvm-builder on 1455261964,pvm-builder,artifact,0,string,AMIs were created:nnus-east-1: ami-efgh
found pvm-builder on 1455261964,pvm-builder,artifact,0,files-count,0
found pvm-builder on 1455261964,pvm-builder,artifact,0,end
real 0m0.063s
user 0m0.036s
sys 0m0.032s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment