I have the following command cloc . that returns the following:
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Clojure                          59           1983            313           8301
Markdown                         13            473              0           1308
Python                           14            340            259            824
Java                             16            161            205            430
Maven                             1              1              4            276
Bourne Again Shell                8             18              2             46
C++                               2              6              0             34
Dockerfile                        1              5              7             16
YAML                              1              0              0             16
Bourne Shell                      1              0              0              1
--------------------------------------------------------------------------------
SUM:                            116           2987            790          11252
--------------------------------------------------------------------------------
My goal is to just get the last number in the SUM row, i.e., 11252. For doing this, I have the following code so far:
line_regex="SUM.*"
while read p
do if [[$p =~ $line_regex]]
   then echo "line is $p"
   fi
done < $(cloc .)
With the goal to be able to print "line is " followed by the SUM line. However, I'm getting the following error:
 line 7: $(cloc .): ambiguous redirect
How to fix this?
 
    