I'm trying to get below output but always output comes with one more newline. How can I obtain desired output?
Desired output: 3 number of line detected
Actual output:
3
number of line is detected.
linecount= awk '{/^./ && c++};END{print c}' < test.txt //// (or cat text.txt | wc -l (both is ok))
if [ -s test.txt ]; then
echo $linecount number of line detected
echo
else
echo No line detected.
echo