Reputation: 1
Running sed for counting lines in my file returns 1, but Sublime and Textedit count more than 88000 lines. Why does sed do that? How can I fix it?
$sed -n '$=' out_data1.txt
1
I use sed to count lines of a very large file ~10GB of mongodb query result to split it later for multithread.
Upvotes: 0
Views: 1884
Reputation: 10039
sed have some buffer limit but try (i don't recommand sed on huge file especially just for counting lines)
sed -u -n "$="
maybe a "s/.*//;$="
if there is also a buffer problem on line size itself
Upvotes: -1
Reputation: 41456
You command should work, but try:
wc -l out_data1.txt
or just for test
awk 'END {print NR}' data1.txt
Upvotes: 3