I have severial variables with prefix INPUT:
${INPUT_1:="sample.txt"}
${INPUT_2:="sample_2.txt"}
${INPUT_3:="sample_3.txt"}
And then I get a list of variable value with prefix INPUT by :
env | awk -F= '/^INPUT/ {print $2}'
the result:
sample.txt sample_2.txt sample_3.txt
And then I want to count the lines of each these three file, I tried
var = env | awk -F= '/^INPUT/ {print $2}'
wc -l $var
But it didn' work. Does someone could help me with applying wc -l on the variables selected?
The easiest way looks like this I guess :
for input in $var
do
wc -l $input
done