Saturdaynight Ubuntu puzzle

For the Unix saturday night puzzle entry:


#!/bin/bash

cat $1|while read EMPID FIRST INIT LAST JOB SEX DATEX SAL EXT1 EXT2
do
if [[ ${SAL} == "" && FIRST != "" ]];
then
SAL=${DATEX}
DATEX=${SEX}
SEX=${JOB}
JOB=${LAST}
LAST=${INIT}
INIT="";
fi
let DATEPOCH=`date -d "$DATEX" +%s 2>/dev/null` 2>/dev/null

let DATEPOCH=${DATEPOCH}-1
DATEX=`date --date @${DATEPOCH} +"%Y-%m-%d"`
if [[ ${EXT1} != "" ]];
then
printf "Emp ID firstNme Init lastName job sex DOJ salary\n";
else
printf "%6s %-9s %3s %-9s %-8s %1s %10s %s\n" "$EMPID" "$FIRST" "$INIT" "$LAST" "$JOB" "$SEX" "$DATEX" "$SAL";
fi
done


Comments are closed.