unix - How to store the value of cat command in the variable var? -
i'm trying find number of times string repeated in file, @ same time i've store in variable.
when use command (cat filename | grep -c '123456789') , displays count correctly when use below command shows command not found.
var =$(cat filename | grep -c '123456789') echo $var can u let me know i'm wrong ?
don't use spaces around = sign:
var=$(cat filename | grep -c '123456789') read @ least bash prog intro howto
but you've got useless use of cat code simply
var=$(grep -c '123456789' filename)
Comments
Post a Comment