Hi,
I try to grep a file (syslog file) and display the result using a loop. Unfortunatly, there is an issue with the code below because of the libefeed/carriage return.
I try to find a way to have each grep result into a single line so I can use it into a the loop:
Code:
for res in $(grep 'pam_unix' $LOG_DIR/$server--$YEAR-$MONTH_D-$DAY_D_ZERO.log | grep 'session opened' | grep -v 'closed'); do
echo "res : $res"
done
Right now, each 'res' results is a single word from the grep result... I can't find a way to catch the end of line and put the the line into the 'res' variable.
Any help will be greatly appreciated!
Thanks