Computing.Net > Forums > Programming > Copy line from multiple text files

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Copy line from multiple text files

Reply to Message Icon

Name: Popie
Date: February 23, 2009 at 09:00:59 Pacific
OS: Windows Vista
Subcategory: Batch
Comment:

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!



Sponsored Link
Ads by Google

Response Number 1
Name: stephenturns
Date: February 23, 2009 at 21:39:46 Pacific
Reply:

Is the text you need to copy always going to be the same line or as the case of the example, the second line?


0

Response Number 2
Name: Popie
Date: February 24, 2009 at 01:34:52 Pacific
Reply:

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


0

Response Number 3
Name: stephenturns
Date: February 25, 2009 at 15:08:30 Pacific
Reply:

I think an example might help.


0

Response Number 4
Name: Popie
Date: March 3, 2009 at 06:43:12 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Copy line from multiple text files

Delete blank lines from a text file www.computing.net/answers/programming/delete-blank-lines-from-a-text-file/14525.html

deleting multiple lines in multiple text file www.computing.net/answers/programming/deleting-multiple-lines-in-multiple-text-file/19862.html

Extract Lines from a Text File www.computing.net/answers/programming/extract-lines-from-a-text-file/13817.html