文件: root - diary - 2008 - 2008-12 - 2008-12-19_02.11AM.html
标签: 计算机, Computing, | 英文 | 主页 | 类别: 计算机科学 | 20978 次阅读, 46417 次搜索 | 303 个单词
| 浏览 | 博客存档
标签: 计算机, Computing, | 英文 | 主页 | 类别: 计算机科学 | 20978 次阅读, 46417 次搜索 | 303 个单词
| 浏览 | 博客存档
Power of windows command shell
I managed to use just pure windows command shell scripting to process around 500M text data ....
pure means not external exe/com files needed,,, just windows built-in commands (e.g. for, call, if ... )
amazing,,, windows scripting (*.bat, *.cmd) can just do almost anything... it is as powerful as linux shell script...
ok ,, here is the task....
there is a csv file,, let's say A.csv, which contains something like this...
1 5 2 18 0 24 18 0 54
2 5 3 18 1 14 18 1 44
3 5 4 18 2 2 18 2 36
4 5 5 18 3 1 18 3 31
5 5 6 18 4 0 18 4 45
6 5 7 18 5 10 18 5 59
7 5 8 18 6 19 18 7 6
...
...
the first column is id
the second is x co-ordinate
the third is y co-ordinate
and the rest are
start-hour,
start-minute,
start-second,
end-hour,
end-minute,
end-second
the first job would be list all the files following this pattern "EOS20081217hmshms" between the intervals recording by A.csv
for example,
18 0 24 18 0 54
you need to get the list of files between EOS2008121800.spa to EOS2008180054.spa (files exist and in this time interval)
what is spa file ?
a spa file is a text file ...
i've got few thousands of them...
we are only interested in part of spa file... say from line 564 to 1114
they look something like this.
P_0=-131.268000 , 3524.995001 MHz
P_1=-127.844000 , 3524.995019 MHz
P_2=-135.736000 , 3524.995037 MHz
P_3=-135.956000 , 3524.995055 MHz
P_4=-137.352000 , 3524.995073 MHz
P_5=-135.692000 , 3524.995091 MHz
...
...
ok,,, among this data,,, we need to find out the maximum value of the first number right after "=" among these numbers..
in P_0 to P_5,, the maximum value is -127.844000
after that,,, we need to list these max numbers into B.csv
1 5 2 16 -58.06 -56.756 -55.236 -56.464 -56.264 -56.348 -56.228 -56.456 -56.092 -57.02 -56.688 -56.48 -57.82 -55.792 -54.372 -56.616
each row of B.csv would be in the format of
id, x, y, number of spa files, max value of spa file1, max value of spa file2 ... ...
that is it,,, not an easy job, right? :)
hint: for statement is very power,,, just few "FOR" does the job!
标签: 计算机, Computing, | 英文 | 主页 | 类别: 计算机科学 | 20978 次阅读, 46417 次搜索 | 303 个单词 I managed to use just pure windows command shell scripting to process around 500M text data ....
pure means not external exe/com files needed,,, just windows built-in commands (e.g. for, call, if ... )
amazing,,, windows scripting (*.bat, *.cmd) can just do almost anything... it is as powerful as linux shell script...
ok ,, here is the task....
there is a csv file,, let's say A.csv, which contains something like this...
1 5 2 18 0 24 18 0 54
2 5 3 18 1 14 18 1 44
3 5 4 18 2 2 18 2 36
4 5 5 18 3 1 18 3 31
5 5 6 18 4 0 18 4 45
6 5 7 18 5 10 18 5 59
7 5 8 18 6 19 18 7 6
...
...
the first column is id
the second is x co-ordinate
the third is y co-ordinate
and the rest are
start-hour,
start-minute,
start-second,
end-hour,
end-minute,
end-second
the first job would be list all the files following this pattern "EOS20081217hmshms" between the intervals recording by A.csv
for example,
18 0 24 18 0 54
you need to get the list of files between EOS2008121800.spa to EOS2008180054.spa (files exist and in this time interval)
what is spa file ?
a spa file is a text file ...
i've got few thousands of them...
we are only interested in part of spa file... say from line 564 to 1114
they look something like this.
P_0=-131.268000 , 3524.995001 MHz
P_1=-127.844000 , 3524.995019 MHz
P_2=-135.736000 , 3524.995037 MHz
P_3=-135.956000 , 3524.995055 MHz
P_4=-137.352000 , 3524.995073 MHz
P_5=-135.692000 , 3524.995091 MHz
...
...
ok,,, among this data,,, we need to find out the maximum value of the first number right after "=" among these numbers..
in P_0 to P_5,, the maximum value is -127.844000
after that,,, we need to list these max numbers into B.csv
1 5 2 16 -58.06 -56.756 -55.236 -56.464 -56.264 -56.348 -56.228 -56.456 -56.092 -57.02 -56.688 -56.48 -57.82 -55.792 -54.372 -56.616
each row of B.csv would be in the format of
id, x, y, number of spa files, max value of spa file1, max value of spa file2 ... ...
that is it,,, not an easy job, right? :)
hint: for statement is very power,,, just few "FOR" does the job!
猜您喜欢...
- Find the non-duplicate number
- CPU Utilization
- Generate All IP Addresses
- Daily Interview Problem: Given two arrays, write a function to compute their intersection.
- Daily Interview Problem: Minimum Removals for Valid Parenthesis
- First and Last Indices of an Element in a Sorted Array
- Daily Interview Problem: Sort Colors
- Floor and Ceiling of a Binary Search Tree
- Daily Interview Problem: Spiral Traversal of Grid
- Algorithm Interview: Shifted String
©2006~2024 牛排过熟 - 0.01346 秒 - 1415.13 KB/s - 26 在线 内存: 493.65 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
牛排怎么做才好吃? | <meta name="机器人" content="不索引, 跟踪" />
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - 服务器 PHP 版本号: 7.4.33
评论 (0)
读写完全 - 一般 - 最小 - 表格 - 所有评论 - 统计
当前页暂时没有评论。