How do i remove all words that do not contain Letter B for example

Discussion in 'Lounge' started by passeee, Dec 2, 2023.

  1. passeee

    passeee Guest

    Lets say i have a document and i want to remove all words that do not contain letter B

    how do i do it

    thanks
     
  2.  
  3. Lois Lane

    Lois Lane Audiosexual

    Joined:
    Jan 16, 2019
    Messages:
    4,856
    Likes Received:
    4,774
    Location:
    Somewhere Over The Rainbow
    I got one of those documents in an email that had no letter b and am trying to find a way to put them back.
     
    • Funny Funny x 1
    • Creative Creative x 1
    • List
  4. Crinklebumps

    Crinklebumps Audiosexual

    Joined:
    Nov 1, 2017
    Messages:
    995
    Likes Received:
    721
    Location:
    UK
    Maybe highlight all words with the letter B, that should be doable in a text editor, maybe even Word... Then select all the highlighted words, a step that I don't know which software will do, copy and paste, delete the original?
     
  5. clone

    clone Audiosexual

    Joined:
    Feb 5, 2021
    Messages:
    7,566
    Likes Received:
    3,334
    if you were using Excel, you could do Conditional Formatting for every cell with a "B" in it, to highlight with any color, then Sort by Color, and delete all of them. Would take you about 30 seconds.

    If you were doing it in Word, you could make a very quick vba macro. There are utility programs you can use too. Mass Replacer iirc was decent. That's more for a hex editor type of scenario.
     
    • Agree Agree x 2
    • Interesting Interesting x 1
    • Useful Useful x 1
    • List
  6. orbitbooster

    orbitbooster Audiosexual

    Joined:
    Jan 8, 2018
    Messages:
    1,125
    Likes Received:
    626
    The fastest way: you have to create a script.
    Long ago I used embedded VB in Office, I think there are similar tools (developer) today.
     
  7. Moogerfooger

    Moogerfooger Audiosexual

    Joined:
    Jun 11, 2016
    Messages:
    1,447
    Likes Received:
    781
    In Windows, you can achieve this using PowerShell commands. Here's an example:

    ```powershell
    (Get-Content "your_file.txt") -replace '\b\w*b\w*\b', '' | Set-Content "output_file.txt"
    ```

    Replace `"your_file.txt"` with the name of your input file and `"output_file.txt"` with the desired output file. This command will remove all words containing the letter 'b' from the text file.
     
  8. r4e

    r4e Audiosexual

    Joined:
    Sep 6, 2014
    Messages:
    869
    Likes Received:
    1,247
    Hm, I once wrote a batch script (Windows) that deletes specific words/phrases from a txt file.
    I used it to clear up html data/elements to get plain links from some website source.

    But I had to define what to delete/replace exactly. This script is also like 12 years old so there could be better methods.

    Code:
    @echo off & setlocal
    pushd "C:\Users\SkyNet\Desktop\Ultra\Batch\replace_txt_content"
    set R=%temp%\Replace.vbs
    >%R% echo F=WScript.Arguments(0):Set fso=CreateObject("Scripting.FileSystemObject"):T=fso.OpenTextFile(F).ReadAll:fso.CreateTextFile(F).Write Replace(T,"This Word","That Word")
    for /f "delims=" %%i in ('dir /b /a-d *.txt') do cscript //nologo %R% "%%i"
    popd
    This will open any txt document in the "replace_txt_content" folder, scan for "This Word" entries
    and replace them with "That Word". When you just add the quotes without content (T,"This Word",""), it'll delete
    all entries containing "This Word".
     
  9. stopped

    stopped Platinum Record

    Joined:
    Mar 22, 2016
    Messages:
    586
    Likes Received:
    209
    notepad++ will do regex find/replace which can do what you want (although learning regex is kind of the worst)
     
  10. pratyahara

    pratyahara Guest

    ScreenShot_20231203011336.png
    Multiple Find and Replace
    Required software:

    "Find And Replace Multiple Files" is a tool that caters to users who frequently work with text documents, giving them the possibility to seamlessly find and replace text across multiple files at the same time. A simple and intuitive interface split into two areas: files list and typical search - replace boxes where you just enter your keywords.

    Command line parameters
    In addition to GUI (Graphical User Interface), Find And Replace Multiple Files can also be used from Windows command prompt.
    P.S. It can easily be found for "free".
     
    Last edited by a moderator: Dec 3, 2023
Loading...
Similar Threads - remove words contain Forum Date
How to remove unwanted addresses? FL Studio Nov 30, 2024
Help Needed: Ultimate Vocal Remove (UVR) Software Nov 17, 2024
Is there a tool to remove notes from a track with harmonics? Working with Sound Oct 7, 2024
How to remove reverb from music released on CD how to make "that" sound Sep 13, 2024
Ultimate Vocal Remover - project abandoned?.. Software Aug 20, 2024
Loading...