回复 1# newbat123
你试试,看看结果,是否能解决问题
在P文中用gawk处理,gawk下载:http://www.bathome.net/s/tool/index.html?down&key=gawk- @echo off&Title 测试
- set a=a2014.11.15.txt
- set b=b2014.11.15.txt
- set #1=1.txt
- set #2=2.txt
- set #3=3.txt
- set #4=4.txt
- CALL :_A&CALL :_B
- gawk "{if(NR==1){print $0 >\"%#1%\";print $0 >\"%#2%\"}else{if($3==null){print $0 >\"%#1%\"}else{print $0 >\"%#2%\"}}}" "%a%"
- gawk "{if(NR==1){print $0 >\"%#3%\";print $0 >\"%#4%\";exit}}" "%b%"
- gawk "{if(FNR>1){print $0}}" "%#1%" "%b%"|gawk "{if(!($1$2 in a)){ a[$1$2];print >>\"%#4%\"}else{print >>\"%#3%\"}}"
- gawk "/.*/" "%#4%"|gawk "{if($3!=null){print >\"%#4%\"}}"
- pause&exit
-
- :_A
- (
- echo 廓线日期 廓线时间 数据1 数据2 数据3 数据4 数据5 数据6 数据7 数据8 数据9 数据10 数据11 数据12 数据13 数据14 数据15 数据16 数据17 数据18 数据19 数据20 数据21 数据22 数据23
- echo 11/02/2014 12:27:55
- echo 11/02/2014 22:37:54
- echo 11/05/2014 02:07:48 10.4628 10.2529 9.98309
- echo 11/05/2014 02:12:48 10.4628 10.2229 9.83319
- echo 11/05/2014 02:17:48
- echo 11/05/2014 02:22:48 10.3428 10.103 9.62334
- )>"%a%"
- goto :eof
- :_B
- (
- echo 廓线日期 廓线时间 OH1 OH2 OH3 OH4 OH5 OH6 OH7 OH8 OH9 OH10 OH11 OH12 OH13 OH14 OH15 OH16
- echo 11/02/2014 12:27:55 0.359751
- echo 11/02/2014 12:37:55 0.359751
- echo 11/02/2014 12:42:55 0.359751 1.88869
- echo 11/02/2014 12:47:55 0.359751
- echo 11/05/2014 02:17:48 0.359751 1.94865
- echo 11/02/2014 13:02:55 0.38973
- echo 11/06/2014 07:17:44 0.359751
- )>"%b%"
- goto :eof
复制代码
|