[SOLVED] software to extract data from multiple text files

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
hansencomputers
Level 3
Level 3
Posts: 147
Joined: Sat Oct 25, 2008 12:51 am

[SOLVED] software to extract data from multiple text files

Post by hansencomputers »

Greetings,
Can anyone point me to some software that will extract data from multiple text files?

What I have are multiple text files (.txt) and each one has some data in the same location. This data consists of text plus a number IE. "Passed 36"

All the text files will have this text and number (the number will vary) in the same location, as in the same line.

Ultimately, I want to sum all the parts that "passed" to get a grand total. My test equipment generates a text file after every test run, and includes the number of parts that passed.

I'm just wondering if there is software available to work with these multiple (maybe thousands) of text files, and get the number from a specific line, and sum it up (if I can just get all the numbers, I can use a spreadsheet to get the sum).

As always, any guidance is greatly appreciated.

Sincerely,
Mike Hansen
Last edited by hansencomputers on Wed Oct 06, 2010 11:01 am, edited 1 time in total.
unexistance
Level 5
Level 5
Posts: 636
Joined: Tue Aug 05, 2008 12:28 am
Location: Malaysia

Re: software to extract data from multiple text files

Post by unexistance »

Hi,

Frankly said, this looks like a solution for a script (non-GUI software) ...

Are you OK with that?

Regards,
:: Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved ::
User avatar
DataMan
Level 6
Level 6
Posts: 1234
Joined: Thu Dec 04, 2008 6:47 am
Location: Carmel, Midwest USA at /var/www
Contact:

Re: software to extract data from multiple text files

Post by DataMan »

It should be easy to accomplish in any of the supported programming languages.

I can help in php, but that means that you will need to have an active LAMP server up and running first. Probably more effort than it's worth.

Stay tuned as someone versed in python, c++ or bash using a regular statement may chime in for an easier solution.

-DataMan
Linux'd since 2005 Linux ID 422356 Ubuntu ID 15015
User avatar
markfiend
Level 4
Level 4
Posts: 310
Joined: Wed Apr 15, 2009 2:56 pm
Location: Leeds, UK

Re: software to extract data from multiple text files

Post by markfiend »

grep seems to be what you are looking for.

Open a terminal, navigate to the folder with all your text files and

Code: Select all

grep Passed *.txt
You can pass the output into another file like this:

Code: Select all

grep Passed *.txt > output.txt
Your output.txt will contain all lines from the source files which include the word "Passed". It doesn't need to know which line "Passed" appears in.
Omnia mutantur, nihil interit.
hansencomputers
Level 3
Level 3
Posts: 147
Joined: Sat Oct 25, 2008 12:51 am

Re: software to extract data from multiple text files

Post by hansencomputers »

Thanks everyone. I will look at the grep option. I'm at work right now, running Windoze. Will need to bring my laptop in to try this.

Answer to one of the questions: I don't mind if it is not a GUI program, but I may need guidance to get started. I have some limited programming experience with VB.NET, and also I use VBA here at work (Excel).


I will comment again if the grep option works for me.


Mike
hansencomputers
Level 3
Level 3
Posts: 147
Joined: Sat Oct 25, 2008 12:51 am

[SOLVED] Re: software to extract data from multiple text fil

Post by hansencomputers »

The suggestion to use "grep" worked great. Problem solved. I have what I need.

Thanks,
Mike
Post Reply

Return to “Software & Applications”