Copy line from multiple text files

February 23, 2009 at 09:00:59
Specs: Windows Vista
Hi,

I don't know how to really work DOS but I really need help! I would need a bat file that can copy 1 specific line from each one of a number of txt files, and paste that line from every txt into a new final txt that would contain all of them. Could someone help me?
For example I have:
1.txt
a
b
c

2.txt
a
b
c

I need to have
3.txt
b
b

(both b and b from files 1.txt and 2.txt.)
Thank you for your help!


See More: Copy line from multiple text files

Report •


#1
February 23, 2009 at 21:39:46
Is the text you need to copy always going to be the same line or as the case of the example, the second line?

Report •

#2
February 24, 2009 at 01:34:52
It is always going to be the same line but the numbers that follow the first word will change.
For example it could say
Totals: 123 456
but then it could change to
Totals: 675 456

I need the entire "Totals:" line every time from every file.
But just that line. All of the other lines or text in the file are not necessary. If you need an example I could post one


Report •

#3
February 25, 2009 at 15:08:30
I think an example might help.

Report •

Related Solutions

#4
March 3, 2009 at 06:43:12
Please see below an example:
Text1 contains:
## Analysis Log file ##

Created:
Date : Monday, December 22, 2008
Time : 12:51:59
Version : XXXX

New Files:
Selected : 1

Old Files:
Selected : 0


Starting analysis process....


File : xxxx

File Statistics:
Segments Words AP Words Total Percentage Char Count (Spaces) Char Count (No Spaces)
Replicated : 13 - 40 40 ( 2.0%) 292 265
100% matched : 30 35 - 35 ( 1.8%) 204 199
95% to 99% matched : 14 17 8 25 ( 1.3%) 148 138
85% to 94% matched : 14 0 223 223 ( 11.3%) 1291 1090
75% to 84% matched : 11 0 148 148 ( 7.5%) 851 717
50% to 74% matched : 0 0 0 0 ( 0.0%) 0 0
Untranslated : 218 - - 1503 ( 76.1%) 9725 8416
Totals : 300 52 419 1974 12511 10825

Time taken to process file : 0 minutes, 24 seconds


From this file the only line I need is ---> Totals : 300 52 419 1974 12511 10825

In some other text, this line's number will be different, but with the same structure, for example--->
Totals : 500 76 456 1234 45673 18695

I need to isolate all these lines along with theri numbers in one new, different file.
Does this help? Thank you so much!!


Report •


Ask Question