if, word count

Hi,

I need to count the lines of a file stack.html and if the amount lines i want to do something.
At this moment, I have

if [ wc -l stack.html -gt 4 ]; 
then ...

This is not working. Any ideas?
Thanks!

linecnt=$( cat myfile.html | wc -l )  # not a UUOC because we want one result
if [ $linecnt - gt 4 ] ; then
  # do something
fi
1 Like

IMHO:

$(wc -l < infile)
1 Like

perfect, thanks mate