批次,读课文文件第n行至第M行 [英] batch, read texts files in n'th line to m'th line

查看:145
本文介绍了批次,读课文文件第n行至第M行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新约批处理命令。

我在不同的文件夹五个文本文件。例如,

I have five text files in different folders. For example,

c:\case1\case1.txt
c:\case2\case2.txt
c:\case3\case3.txt

所以我想读取第n行这些文本文件,以行第m
写在同一个文本文件这些值。我怎样才能让批处理文件?

So I want to read these text files from nth line to mth line and write these values in same text file. How can I make batch files?

例如,结果文本文件,我想要的是......

For example, the result text file I want is....

案例1

10456          <--- this valus is in n'th line in case1.txt    
3456           <--- this valus is in n+1'th line in case1.txt    
23455          <--- this valus is in n+2'th = m'th line in case1.txt

案例2

49566          <--- this valus is in n'th line in case2.txt
85494          <--- this valus is in n+1'th line in case2.txt
38566          <--- this valus is in n+2'th = m'th line in case2.txt

情形3

49658          <--- this valus is in n'th line in case3.txt    
48569          <--- this valus is in n+1'th line in case3.txt    
39245          <--- this valus is in n+2'th = m'th line in case3.txt 

这样的。

和重要的是....其实,我真正的新约批次。所以,你能写满命令不仅命令的一部分。

And important is.... Actually, I really new about batch. So could you write full command not only part of command.

三江源非常多!

推荐答案

如果你可以下载的东西,你可以使用的 GNU sed的至4号线
例如:

if you can download stuff, you can use GNU sed from line 2 till line 4 example

sed -n "2,4p" file

这篇关于批次,读课文文件第n行至第M行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆