I want to do a line count and get the number into a variable in a shell script. For eg.
wc -l filename.dat
gives 221 filename.dat
I want to grep '221' into a variable, which I could use later.
Can this be done in a single statement ? I don't want to copy the output of wc -l
into another file and then grep.