Hello I would like to count number of words with specific lengths. I'm using this command.
awk 'length == 2' mydict.txt | wc -l
this code gives what I want but if try to put variable instead of number 2 it doesnt work. The code is like this
awk 'length == $var' mydict.txt | wc -l
and terminal prints 0. What can I do?
count number of words with specific length
", it counts the number of lines having 2 *characters* length only not words. – αғsнιη Jan 11 '22 at 16:20