找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 28530|回复: 3

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

[复制链接]
发表于 2020-7-29 10:20:06 | 显示全部楼层 |阅读模式
如下,需要提取标红的数据为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
复制代码
 楼主| 发表于 2020-7-29 10:20:42 | 显示全部楼层
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.
发表于 2020-7-29 13:13:48 | 显示全部楼层
回复 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. )
复制代码

评分

参与人数 1技术 +1 收起 理由
dailyad + 1 多谢

查看全部评分

 楼主| 发表于 2020-7-29 19:49:00 | 显示全部楼层
回复 3# Batcher


:handshake
   
:handshake
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-20 03:58 , Processed in 0.017085 second(s), 8 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表