Board logo

标题: [文本处理] 求思路:批处理提取指定位置的数据 [打印本页]

作者: dailyad    时间: 2020-7-29 10:20     标题: 求思路:批处理提取指定位置的数据

如下,需要提取标红的数据为B列,并以文件名位A列,存为CSV。求大神给一个思路‘、
数据一般在固定行,第10行,第二个数据’
  1. Reading input ... done.
  2. Setting up the scoring function ... done.
  3. Analyzing the binding site ... done.
  4. Using random seed: -1077514464
  5. Performing search ... done.
  6. Refining results ... done.
  7. mode |   affinity | dist from best mode
  8.      | (kcal/mol) | rmsd l.b.| rmsd u.b.
  9. -----+------------+----------+----------
  10.    1        [color=Red]-11.7 [/color]     0.000      0.000
  11.    2        -11.4      3.334      6.584
  12.    3        -11.4      4.283      6.896
  13.    4        -11.2      1.316      3.968
  14. Writing output ... done.
复制代码
  1. A            B
  2. 文件名    -11.7
复制代码

作者: dailyad    时间: 2020-7-29 10:20

Reading input ... done.
Setting up the scoring function ... done.
Analyzing the binding site ... done.
Using random seed: -1077514464
Performing search ... done.
Refining results ... done.

mode |   affinity | dist from best mode
     | (kcal/mol) | rmsd l.b.| rmsd u.b.
-----+------------+----------+----------
   1        -11.7      0.000      0.000
   2        -11.4      3.334      6.584
   3        -11.4      4.283      6.896
   4        -11.2      1.316      3.968
Writing output ... done.
作者: Batcher    时间: 2020-7-29 13:13

回复 1# dailyad
  1. @echo off
  2. set "SrtFile=1.txt"
  3. set "DstFile=1.csv"
  4. cd /d "%~dp0"
  5. >"%DstFile%" echo A,B
  6. for /f "skip=10 tokens=2" %%i in ('type "%SrtFile%"') do (
  7.     >>"%DstFile%" echo %SrtFile%,%%i
  8.     goto :eof
  9. )
复制代码

作者: dailyad    时间: 2020-7-29 19:49

回复 3# Batcher


:handshake
   
:handshake




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2