How to store the value of cat command in the variable var?
unix
Solution
Don't use spaces around the `=` sign:
var=$(cat filename | grep -c '123456789')
Read at least the Bash Prog Intro Howto
But you've got a useless use of `cat` so code simply
var=$(grep -c '123456789' filename)
Problem
I'm trying to find the number of times a string is repeated in a file, at the same time i've to store it in a variable. When i use the command (`cat filename | grep -c '123456789'`) , it displays the count correctly but when i use the below command it shows as command not found. ``` var =$(cat filename | grep -c '123456789') echo $var ``` Can u let me know where i'm wrong ?