- 帖子
- 3
- 积分
- 15
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2014-7-9
|
[文本处理] 一批txt文本数据,但是每个文本的数据前后都有一段文字,怎么把它们批量删除
我计算得到了一系列的txt文本数据,但是数据的前后都有一段不相干的文字,需要把它们删掉。因为文本文件特别多,而且文字内容基本相同,想请问大家怎么才能将他们批量删掉呢。我的数据结构是这样子的:
HDF5 "F:\vorpalPractice\NEW\double_elec_9.h5" {
GROUP "/" {
DATASET "elec" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SIMPLE { ( 8603, 4 ) / ( 8603, 4 ) }
DATA {
2.23485e-007, -1.22095e+009, 1.23731e+010, 0,
3.5827e-007, -3.86357e+009, 8.98812e+009, 0,
9.73365e-007, 8.47243e+009, 1.87369e+010, 0,
1.23498e-006, 2.08709e+010, 2.08869e+010, 0,
1.76197e-006, 4.30957e+010, 1.86984e+010, 0,
1.87929e-006, 3.84299e+010, 4.68776e+009, 0,
2.15484e-006, 4.31901e+010, 2.50598e+009, 0,
2.24162e-006, 4.81664e+010, -8.14704e+008, 0,
2.24279e-006, 4.4624e+010, -1.17517e+009, 0,
2.24702e-006, 1.58285e+010, 1.00164e+010, 0,
2.25199e-006, 1.36558e+010, 5.24117e+009, 0,
}
ATTRIBUTE "charge" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SCALAR
DATA {
-1.60218e-019
}
}
ATTRIBUTE "mass" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SCALAR
DATA {
9.10938e-031
}
}
ATTRIBUTE "numPtclsInMacro" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SCALAR
DATA {
4.45942e+018
}
}
ATTRIBUTE "numSpatialDims" {
DATATYPE H5T_STD_I32LE
DATASPACE SCALAR
DATA {
1
}
}
ATTRIBUTE "ptclEnds" {
DATATYPE H5T_STD_I32LE
DATASPACE SIMPLE { ( 32 ) / ( 32 ) }
DATA {
21, 71, 92, 153, 193, 742, 1792, 3138, 4652, 6150, 7597, 8389, 8416, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603, 8603
}
}
ATTRIBUTE "time" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SCALAR
DATA {
1.20053e-013
}
}
ATTRIBUTE "vsLimits" {
DATATYPE H5T_STRING {
STRSIZE 22;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"globalGridGlobalLimits"
}
}
ATTRIBUTE "vsNumSpatialDims" {
DATATYPE H5T_STD_I32LE
DATASPACE SCALAR
DATA {
1
}
}
ATTRIBUTE "vsTimeGroup" {
DATATYPE H5T_STRING {
STRSIZE 4;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"time"
}
}
ATTRIBUTE "vsType" {
DATATYPE H5T_STRING {
STRSIZE 16;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"variableWithMesh"
}
}
}
GROUP "globalGridGlobalLimits" {
ATTRIBUTE "vsKind" {
DATATYPE H5T_STRING {
STRSIZE 9;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"Cartesian"
}
}
ATTRIBUTE "vsLowerBounds" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
0
}
}
ATTRIBUTE "vsType" {
DATATYPE H5T_STRING {
STRSIZE 6;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"limits"
}
}
ATTRIBUTE "vsUpperBounds" {
DATATYPE H5T_IEEE_F32LE
DATASPACE SIMPLE { ( 1 ) / ( 1 ) }
DATA {
8.2e-005
}
}
}
GROUP "runInfo" {
ATTRIBUTE "vsBuildHost" {
DATATYPE H5T_STRING {
STRSIZE 17;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"double.txcorp.com"
}
}
ATTRIBUTE "vsBuildHostType" {
DATATYPE H5T_STRING {
STRSIZE 12;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"Linux-x86_64"
}
}
ATTRIBUTE "vsCMakeRevision" {
DATATYPE H5T_STRING {
STRSIZE 4;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"1317"
}
}
ATTRIBUTE "vsCommandLine" {
DATATYPE H5T_STRING {
STRSIZE 25;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"vorpal -i doubleTarget.in"
}
}
ATTRIBUTE "vsCxxCompiler" {
DATATYPE H5T_STRING {
STRSIZE 42;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"/data/internal/VORPAL-5.2.0/mpi/bin/mpicxx"
}
}
ATTRIBUTE "vsCxxCompilerFlags" {
DATATYPE H5T_STRING {
STRSIZE 18;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
" -fPIC -ansi -pipe"
}
}
ATTRIBUTE "vsCxxCompilerVersion" {
DATATYPE H5T_STRING {
STRSIZE 5;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"4.1.2"
}
}
ATTRIBUTE "vsSoftware" {
DATATYPE H5T_STRING {
STRSIZE 6;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"VORPAL"
}
}
ATTRIBUTE "vsSwRevision" {
DATATYPE H5T_STRING {
STRSIZE 5;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"19343"
}
}
ATTRIBUTE "vsSwVersion" {
DATATYPE H5T_STRING {
STRSIZE 5;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"5.2.0"
}
}
ATTRIBUTE "vsType" {
DATATYPE H5T_STRING {
STRSIZE 7;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"runInfo"
}
}
ATTRIBUTE "vsVsVersion" {
DATATYPE H5T_STRING {
STRSIZE 3;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"2.1"
}
}
}
GROUP "time" {
ATTRIBUTE "vsStep" {
DATATYPE H5T_STD_U64LE
DATASPACE SCALAR
DATA {
35991
}
}
ATTRIBUTE "vsTime" {
DATATYPE H5T_IEEE_F64LE
DATASPACE SCALAR
DATA {
1.20053e-013
}
}
ATTRIBUTE "vsType" {
DATATYPE H5T_STRING {
STRSIZE 4;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SCALAR
DATA {
"time"
}
}
}
}
}
最后想要得到的数据就是只保留中间那些数字,把逗号也删掉:
2.23485e-007 -1.22095e+009 1.23731e+010 0
3.5827e-007 -3.86357e+009 8.98812e+009 0
9.73365e-007 8.47243e+009 1.87369e+010 0
1.23498e-006 2.08709e+010 2.08869e+010 0
1.76197e-006 4.30957e+010 1.86984e+010 0
1.87929e-006 3.84299e+010 4.68776e+009 0
2.15484e-006 4.31901e+010 2.50598e+009 0
2.24162e-006 4.81664e+010 -8.14704e+008 0
2.24279e-006 4.4624e+010 -1.17517e+009 0
2.24702e-006 1.58285e+010 1.00164e+010 0
2.25199e-006 1.36558e+010 5.24117e+009 0
请大家帮帮忙,解决下这个批处理问题啊!
非常感谢! |
|