Quote:
Originally Posted by redone-22
it gives me 4
|
I dare say that getting
4 is impossible.
First of all, there is no option
-l (the letter L) in
tail. You ought to get an error. But, I assume you mean the option
-1 (the digit ONE).
If so, you produce only ONE line from the output. So, what happens when you do a line count on ONE line? You will get the result
1. Always.
Check this out:
Code:
$ cat lines.txt
Line1
Line2
Line3
Line4
Ok, we have a simple file with four lines. Lets count them with wc:
Code:
$ wc -l lines.txt
4 lines.txt
Let's try your approach:
Code:
$ cat lines.txt | tail -1 | wc -l
1
Please provide a sample of when you run the code, and how you can get 4 as a result, because something is very off.
Best regards,
HMW