Not sure the most effient way to do this.
I have figiured out how to extract columns with shell script, but not sure how to convert
This is what I have...
NEWDNS 04-Jun-2011 06:00:59.762 10.220.136.217 crl.verisign.com
This is what I need.... Change date, remove mil seconds, remove periods in the ips and remove the last dot in a url.
NEWDNS 2011-06-04 06:00:59 10 220 136 217 crl.verisign com
Thanks
Here is one possible solution:
!/usr/bin/ksh
typeset -i mInd
set -A mAMon N/A Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
sed -e 's/-/ /g' -e 's/\(.*:..\).\{4\}/\1/' -e 's/\.\([0-9]\)/ \1/g' -e 's/\./ /2' inp_file |
while read mFld1 mDay mMon mYear mRest; do
mInd=1
while [[ ${mInd} -le 12 ]]; do
if [[ "${mMon}" = "${mAMon[$mInd]}" ]]; then
mOutMon=$(printf "%.2d" ${mInd})
break
fi
mInd=${mInd}+1
done
echo "${mFld1} ${mYear}-${mOutMon}-${mDay} ${mRest}"
done