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:
    5,189
    Likes Received:
    5,199
    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:
    1,112
    Likes Received:
    800
    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:
    8,028
    Likes Received:
    3,510
    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,187
    Likes Received:
    663
    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,460
    Likes Received:
    802
    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:
    889
    Likes Received:
    1,282
    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:
    691
    Likes Received:
    254
    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
Kontakt portable UI - ask for help if anybody manage to remove the "portable". Kontakt Friday at 6:47 AM
Software to batch remove empty bars from midi files and split multi track midi? Software Feb 18, 2025
Remove vocals but keep saxophone? UVR Ai for Music Feb 14, 2025
(AI) Remove vocals from dubstep? Ai for Music Jan 31, 2025
How To Remove This Type of Noise/Hiss Spike From Audio Mixing and Mastering Dec 21, 2024
Loading...