l******9 发帖数: 579 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: light009 (light009), 信区: JobHunting
标 题: error of couting total line number in txt file on MSDOS
发信站: BBS 未名空间站 (Thu Nov 20 18:34:45 2014, 美东)
I would like to find the total line number of a text file ( > 60 GB) in MS-
DOS.
I used:
findstr /R /N "^" file.txt | find /C ":"
But, the returned result is a negative number.
It is overflow ?
The file have not more than 5 billion lines.
For an integer (4 Bytes), its max range is From −2,147,483,648 to 2,
147,483,647.
So, I need to design a script to count the number by dividing the result
with 1000 ?
If yes, please help me with how to design the script in MS DOS.
Thanks |
s**********o 发帖数: 14359 | 2 MS-DOS跟我们数据没啥关系,你这个还是TEXT FILE
对待这么大的文件,DOS打开文件内存不够吧 |
l******9 发帖数: 579 | 3 This file was loaded to netezza database.
But, I need to make sure that the all lines in the file have been loaded to
the database.
So, I need to know how many lines the txt file has so that I can compare it
with the table in database.
I only need to know how many lines the file has, I do not need to open the
file.
Thanks !
【在 s**********o 的大作中提到】 : MS-DOS跟我们数据没啥关系,你这个还是TEXT FILE : 对待这么大的文件,DOS打开文件内存不够吧
|
s**********o 发帖数: 14359 | 4 不打开文件怎么数行啊,而且应该数的是ASCII吧,否则有乱码的会出错
显然你没编过程
to
it
【在 l******9 的大作中提到】 : This file was loaded to netezza database. : But, I need to make sure that the all lines in the file have been loaded to : the database. : So, I need to know how many lines the txt file has so that I can compare it : with the table in database. : I only need to know how many lines the file has, I do not need to open the : file. : Thanks !
|
A*******n 发帖数: 625 | 5 var lineCount = File.ReadAllLines(@"C:\file.txt").Length;
or
var lineCount = 0;
using (var reader = File.OpenText(@"C:\file.txt"))
{
while (reader.ReadLine() != null)
{
lineCount++;
}
} |
l******9 发帖数: 579 | 6 I am not allowed to install .NET and do programing on the server.
I can only access the file remotely. It may take long time for a large file
120 GB to run C# locally to get the line number remotely through network.
thanks !
【在 A*******n 的大作中提到】 : var lineCount = File.ReadAllLines(@"C:\file.txt").Length; : or : var lineCount = 0; : using (var reader = File.OpenText(@"C:\file.txt")) : { : while (reader.ReadLine() != null) : { : lineCount++; : } : }
|
s**********o 发帖数: 14359 | 7 说过了DOS内存不够,根本打不开文件,
你要TEST大型BATCH文件,不COPY到LOCAL
根本做不了,无解 |