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 ?
$or[or]. As a very simple regex containing no special characters,123456789doesn't need to be quoted.