this post was submitted on 02 Jul 2026
8 points (100.0% liked)

Technology

42853 readers
85 users here now

This is the official technology community of Lemmy.ml for all news related to creation and use of technology, and to facilitate civil, meaningful discussion around it.


Ask in DM before posting product reviews or ads. All such posts otherwise are subject to removal.


Rules:

1: All Lemmy rules apply

2: Do not post low effort posts

3: NEVER post naziped*gore stuff

4: Always post article URLs or their archived version URLs as sources, NOT screenshots. Help the blind users.

5: personal rants of Big Tech CEOs like Elon Musk are unwelcome (does not include posts about their companies affecting wide range of people)

6: no advertisement posts unless verified as legitimate and non-exploitative/non-consumerist

7: crypto related posts, unless essential, are disallowed

founded 7 years ago
MODERATORS
 

Over the years, I've downloaded a lot of old emails to my laptop, which I saved as .eml files and then converted to .docx, .odt, and .txt files (mostly the last two).

The unfortunate habit of almost everyone (including myself, but no longer!) of quoting the original message as part of an email exchange has left me with text file(s) full of repeated sentences and paragraphs. What I've tended to do is to dump all the text from a one on one correspondence into a single file ("Dad-Erinaceus Complete Correspondence.odt," for example) and then try cleaning it up and re-ordering the messages by date.

Apart from the emails, I have I guess what you'd call a "journal" which is a very long .odt file that runs to about 300 pages or so. Much of this has the same sentences and paragraphs over and over again, but sometimes with slight variations that I would like to keep. So far, in either .odt or .txt files, I've started by searching for the first sentence, deleting subsequent appearances of it, and then going on to the next sentence, and so forth. Very time consuming! Is there a faster (and safe) way to do this?

There is quite possibly a very simple solution to this that I haven't thought of, but I'd be much obliged for any suggestions.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] pheonixdown@sh.itjust.works 1 points 21 hours ago (1 children)

I doubt you'll find anything for this bespoke purpose built as a utility online, so if you want it you'll need to make it (or I guess hire someone).

Python is fairly approachable to learn, the 2nd best time to plant a tree is today. Personally, I'd recommend installing Anaconda and using a Jupyter Notebook. For this process, you'd need to learn about:

  1. "pip" to install any libraries/packages you need.

  2. Importing packages

  3. Working with strings

  4. Getting a list of all files (maybe only those of certain types) in a given directory.

  5. For loops

  6. some way to read each file type (pandas can handle txt, not sure about the others but you should be able to literally just Google "Python import " to find a package. Import them as strings and concatenate a huge list of them in a for loop.

  7. Pandas dataframes, Parsing strings into new columns, including into distinct lists of strings. The complexity here varies a lot based on what you specifically want to get out of the process.

  8. Exporting dataframe rows to files (better imho if you did it as tabs in a workbook, but it is trickier) in a for loop.

Don't overwrite objects as you go and keep different logical chunks in their own cells. That'll make it easier to troubleshoot. Just Google any errors you don't immediately understand, you'll find lots of advice online.

Don't have whatever you make delete any of your original files.

Depending on your feelings about AI, you could probably get one to make something that'll work after a few tries and troubleshooting by giving it error messages, but aside from the ethical problems, you'd never really know if it got it right, even if it seemed to work, so I would recommend against it.

[โ€“] zdhzm2pgp@lemmy.ml 1 points 21 hours ago

You are clearly on a higher level of consciousness than I will ever be (plus I'm old ๐Ÿ‘ด).