开发者

batch, read texts files in n'th line to m'th line

开发者 https://www.devze.com 2023-01-09 18:54 出处:网络
I am new about batch command. I have five text files in different folders. For example, c:\\case1\\case1.txt

I am new about batch command.

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

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

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....

case1

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

case2

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

case3

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'开发者_如何学Goth = m'th line in case3.txt 

like this.

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

Thankyou very much!!


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

sed -n "2,4p" file
0

精彩评论

暂无评论...
验证码 换一张
取 消