![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-11-10 15:34 |
47,815 topics / 349,930 posts / today 0 new / 48,291 members |
| DOS批处理 & 脚本技术(批处理室) » How to sum the 20th number in the 10th line of all txt files |
| Printable Version 4,600 / 20 |
| Floor16 lulala | Posted 2006-09-10 08:42 |
| 初级用户 Posts 17 Credits 44 | |
|
I don't know how to say it, I'm embarrassed. Anyway, it's just that after a program runs, it can add the first number in the 10th line of the txt files in the directory. For example:
1: Anonymous 48 321 166.84 100.00% 0 0.00 NaN% Just add 48, and the following numbers don't need to be cared about. I mean, for different txt files, just add the numbers in the 48 position. 1: Anonymous 148 321 166.84 100.00% 0 0.00 NaN% 1: Anonymous 48 321 166.84 100.00% 0 0.00 NaN% 1: Anonymous 1148 321 166.84 100.00% 0 0.00 NaN% The above three txt files are extracted, and the positions of 8 are all the same in one column. After the program runs, calculate the sum of 148 + 48 + 1148. I have low education, so it's possible that my Chinese level is not enough, sorry. |
|
| Floor17 namejm | Posted 2006-09-10 09:25 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
By comparing the file you uploaded, I found that there is a space after ":", so ":" should be in the first column of the text, and numbers like 148 are in the third column. To solve your problem, you can try the following code:
[ Last edited by namejm on 2006-9-10 at 09:28 ] |
|
| Floor18 lulala | Posted 2006-09-10 09:38 |
| 初级用户 Posts 17 Credits 44 | |
|
Thank you, it's already solved. I really didn't know what the concept of a column is. Can you help explain it? Thanks
|
|
| Floor19 namejm | Posted 2006-09-10 10:34 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
As the saying goes, horizontally and vertically. In a text file, the text in the horizontal direction is called a line, and lines are separated by carriage return symbols; the text in the vertical direction separated by spaces or tabs is called a column, as shown below (assuming that Arabic numerals are the content of the text), 1 is in the first row and first column, and 6 is in the second row and third column:
[ Last edited by namejm on 2006-9-10 at 10:37 ] |
|
| Floor20 lulala | Posted 2006-09-10 10:42 |
| 初级用户 Posts 17 Credits 44 | |
|
Hehe, thank you. This forum is really good
|
|
| Floor21 lulala | Posted 2006-09-10 10:59 |
| 初级用户 Posts 17 Credits 44 | |
|
There is another question. If these txt files are in a certain directory on another machine in the local area network, can I run a program on my own machine to calculate the sum of the numbers in the txt files under the certain directory on that machine? That machine has the default permissions of opening admin$ and ipc$.
|
|
| Prev 1 2 |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |