I want to find the file with the biggest number of words in a directory so I tried to use just the second line from the output of this command :
wc * -w | sort -nr
In fact I know that it will work if i saved the output to a file and used the command sed like this :
wc * -w | sort -nr >> file
sed -n "2p" file
but this is not what I want , I need to do it via the output of the command directly
I tried with a script shell like :
for i in `wc * -w | sort -nr`
do
if test $i -eq 2 then
echo "$i"
fi
done
but it was not what I expected Thank you in advance.