[SOLVED] software to extract data from multiple text files

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
hansencomputers
Level 3
Level 3
Posts: 161
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 LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
unexistance

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,
DataMan

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
markfiend

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.
hansencomputers
Level 3
Level 3
Posts: 161
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 Windows. 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: 161
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
Locked

Return to “Software & Applications”