Analyzing a text file in mathematica

  • Context: Mathematica 
  • Thread starter Thread starter raymound
  • Start date Start date
  • Tags Tags
    File Mathematica Text
Click For Summary

Discussion Overview

The discussion revolves around extracting data from a large Gaussian log file using Mathematica. Participants explore methods for searching through textual data, with a focus on string manipulation and data retrieval techniques within Mathematica.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant expresses a need to extract specific data from a Gaussian log file using Mathematica, indicating a lack of experience with text processing in the software.
  • Another participant questions the necessity of using Mathematica for this task, suggesting that other programming languages like Python might be more suitable for parsing text files.
  • A request is made for a clear example of the text to be processed, emphasizing the importance of clarity in the task description to avoid misunderstandings.
  • A participant claims to have nearly completed the task in Mathematica but seeks assistance on how to search for a string backward from the current position.
  • Another participant humorously contrasts Mathematica's capabilities with Python, suggesting a method to find the last occurrence of a string by searching forwards multiple times.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best tool for the task, with some advocating for Mathematica while others suggest alternatives like Python. The discussion remains unresolved regarding the specific implementation details in Mathematica.

Contextual Notes

There are limitations in the discussion, including a lack of specific examples of the text data and the exact requirements for the extraction process. Additionally, the methods for string searching in Mathematica are not fully explored or clarified.

raymound
Messages
13
Reaction score
0
hi,
I have a big text file which includes lots of text and data (gaussian log file (it's a scan file))
and I need to extract some data from it.
so I need mathematica to search along the textual data and find some strings and put the value in front of that string into a variable.
can you gimme some ideas how to do that, I have never worked with mathematica on textual data
 
Physics news on Phys.org
any particular reason why you say you "need mathematica" to search this text data file?

I have never used mathematica, but I doubt is the best choice for parsing a text file.

I am sure it can be done with mathematica and C and Fortran and Perl and sed and awk...but I this point in my life I would use Python.
 
raymound said:
I have a big text file which includes lots of text and data (gaussian log file (it's a scan file))
and I need to extract some data from it.
so I need mathematica to search along the textual data and find some strings and put the value in front of that string into a variable.

Post a small example fragment of text, possibly even that you have made up, which is an excellent example of the thing you need to search through. Describe exactly what you want to accomplish with that. Make the example good enough that anyone reasonably skilled would not be able to misunderstand what they were supposed to do, even without needing to ask you more questions and without finishing the project only to discover when giving it back to you to get "well that isn't what I wanted to do, how about this different question."

With that it should be feasible to write a few lines of code to accomplish your task
 
I almost did the whole thing and mathematica is perfect for this purpose
I just can't find out how can I tell mathematica to search for a string backward from the current position
if you guys can help
I'll be grateful
 
Well, so much for Mathematica being "perfect" for this :-p ...in python, this is done with rfind() :biggrin:

In Mathematica...can you just simply search forwards, from the beginning, several times until you get to the last position of interest and then pick the occurrence of the string with the largest index?

Like I said, I don't Mathematica...just throwing ideas.
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
10K
  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 6 ·
Replies
6
Views
12K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 5 ·
Replies
5
Views
10K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
5
Views
2K
  • · Replies 6 ·
Replies
6
Views
10K