I am trying to write shell script as below to search user inputted word and highlight the word in the search result -
# User input:
echo -n -e "What you wanna search:"
read userinput
Save the search result in a file
egrep "$input" /var/log/auth.log > result.txt
Display the result column wise with highlighted user input value
column -t result.txt | grep '$userinput' --> (this is not working. It's not highlighted the word)
For example: I am looking for root user in the search result and I want to highlight the root word being highlighted but it's not working.
$ column -t result.txt | grep -n 'root' *--> This is working*
$ column -t result.txt | grep -n '$userinput' **--> This is not working**
Any idea what's I am doing wrong?