westwood01
Technical User
Suppose I have a line numbered (error.dat) file that looks like:
1 : Jun 18 12:05:52 host: hostname1:/some/path/here/some.file
2 : Jun 18 12:05:52 host: hostname2:/some/path/here/some.file
3 : Jun 18 19:38:49 host: hostname3:/some/path/here/some.file
And I have an (error.ksh) script that looks something like:
#!/bin/ksh
echo "
1) View All Errors
2) Create File for Each Error
q) Quit"
echo ""
while true
do
read input
case $input in
1) clear
echo ""
echo "Listing All Errors:"
echo ""
awk '{print $0}' error.dat;./error.ksh;;
2) clear
echo ""
echo "Listing of Errors:"
echo ""
awk '{print $0}' error.dat
echo ""
echo "Select Line Number to Create File"
echo ""
LINE=`awk '{print $1}' data3.email`
read input1
if [ "$input1" = "$LINE" ]
then
echo "It worked"
else
echo "It failed"
fi
q) echo "Exiting..."
sleep 2
exit;;
*) echo "Please try again";./error.ksh
esac
done
Question:
If a user selects option2 and when prompted, enters the number 1 (or 2, or 3), how can I get that number entered to correspond to the same numbered line of the error.dat file? If I have left anything out pls let me know and I'll repost. thanks.
1 : Jun 18 12:05:52 host: hostname1:/some/path/here/some.file
2 : Jun 18 12:05:52 host: hostname2:/some/path/here/some.file
3 : Jun 18 19:38:49 host: hostname3:/some/path/here/some.file
And I have an (error.ksh) script that looks something like:
#!/bin/ksh
echo "
1) View All Errors
2) Create File for Each Error
q) Quit"
echo ""
while true
do
read input
case $input in
1) clear
echo ""
echo "Listing All Errors:"
echo ""
awk '{print $0}' error.dat;./error.ksh;;
2) clear
echo ""
echo "Listing of Errors:"
echo ""
awk '{print $0}' error.dat
echo ""
echo "Select Line Number to Create File"
echo ""
LINE=`awk '{print $1}' data3.email`
read input1
if [ "$input1" = "$LINE" ]
then
echo "It worked"
else
echo "It failed"
fi
q) echo "Exiting..."
sleep 2
exit;;
*) echo "Please try again";./error.ksh
esac
done
Question:
If a user selects option2 and when prompted, enters the number 1 (or 2, or 3), how can I get that number entered to correspond to the same numbered line of the error.dat file? If I have left anything out pls let me know and I'll repost. thanks.