Skip to content

Instantly share code, notes, and snippets.

@AlfredoTigolo
Created April 7, 2019 20:53
Show Gist options
  • Save AlfredoTigolo/750944659b30848e26c3a8c19998d7c8 to your computer and use it in GitHub Desktop.
Save AlfredoTigolo/750944659b30848e26c3a8c19998d7c8 to your computer and use it in GitHub Desktop.
Script that reads a log file and attempts to convert it to csv
====
# This bash script is created for advent ticket CS-49173
#!/bin/bash
filerstrun="/advent/app/logs/rstrun.log"
list=$(awk -F"START" '{ print $2 }' /advent/app/logs/rstrun.log | awk -F"-" '{ print $5 }' | awk -F" " '{ print$1}')
for i in $list; do
#echo $i
#echo
#echo "=== START ==="
#echo $filerstrun
#report=$(more $filerstrun | grep $i )
#echo $report
#date and time
#line1=$( more $filerstrun | grep $i | grep advcron )
storenum=$( more $filerstrun | grep $i | grep DBId | awk -F":" '{ print $2}' )
line2=$( more $filerstrun | grep $i | grep FTP | awk -F"," '{ print $2 }' )
line3=$( more $filerstrun | grep $i | grep executing | awk -F" " '{print $5 $6 $7 $8 }' )
#echo $line1
echo -e $storenum "," $line2 "," $line3 '\n'
#echo $line2
#echo $line3
#echo "== END ==="
#echo
done
===
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment