total newb here. call me a script kiddie if you want but here is what i need to do and what i have.
need to:
search a hidden log file for a specific string, find what comes after that part, and then output the result to a variable or something that can be used by an application or other script to carry out further actions.
example:
self.selectedAuxStateStr = Available
self.selectedAuxStateStr = 2 Training
i need to find "self.selectedAuxStateStr = " and then determine what state it is currently in. also, since the log is in chronological order i will need to start at the bottom and find the LAST instance of this string.
here is what i have so far
Code:
( date; uname -a ) >>logfile
# Time and machine name
echo ---------------------------------------------------------- >>logfile
tail -n $LINES /var/log/system.log | tr -d "\"'" | xargs | fmt -s >>logfile
echo >>logfile
echo >>logfile
echo "self.selectedAuxStateStr = " | tr '' ' '
echo "success"
exit 0