Hi all. My trouble I think is with IFS. The log that I am trying to output is separated only by commas. IFS uses spaces so in my script, I used $IFS="," but the script doesn't seem to like that. Can anyone help. Here's what I have so far. # /bin/ksh!
$IFS= ","
echo "\tPlease enter the battery number you wish to search for..."
read ans
if [[ $ans != 0 ]]
then
cat /dso/eis/log/batlog.log.* | grep $ans > /dso/eis/log/battsearch.log
awk 'BEGIN { print "LRT DATE TIME OLD BATT NAME DEPT IN/OUT NEW BATT STATUS"
print "--- ---- ---- -------- ---- ---- ------ -------- ------"}
{ printf "%-5s%-5s%-5s%-5s %s\n", $1, $2, $3, $4, $6, $7, $8, $9 }' /dso/eis/log/battsearch.log
else
exit
fi
echo "\tWould you like to print this? (y/n)"
read ans1
if [ $ans1 = "y" -o $ans1 = "Y" ]
then
lp -dps@pr7 /dso/eis/log/battsearch.log
else
exit
fi
$IFS=" "
Thanks for the help.
$IFS= ","
echo "\tPlease enter the battery number you wish to search for..."
read ans
if [[ $ans != 0 ]]
then
cat /dso/eis/log/batlog.log.* | grep $ans > /dso/eis/log/battsearch.log
awk 'BEGIN { print "LRT DATE TIME OLD BATT NAME DEPT IN/OUT NEW BATT STATUS"
print "--- ---- ---- -------- ---- ---- ------ -------- ------"}
{ printf "%-5s%-5s%-5s%-5s %s\n", $1, $2, $3, $4, $6, $7, $8, $9 }' /dso/eis/log/battsearch.log
else
exit
fi
echo "\tWould you like to print this? (y/n)"
read ans1
if [ $ans1 = "y" -o $ans1 = "Y" ]
then
lp -dps@pr7 /dso/eis/log/battsearch.log
else
exit
fi
$IFS=" "
Thanks for the help.