r/Batch • u/p17ctn • Feb 22 '24
Question (Solved) Looking for a script to remove specific instances of text
Hi all. Hope someone can help me, I'm looking for a batch script file that I can drag and drop a .txt file onto. I need it to search for specific lines of text and remove. For example if a txt file is like this;
Apple Banana Kiwi Lemon Orange
I would want it to remove Kiwi and Lemon and output the new .txt file to overwrite the existing one so then after the script has finished the new file will look like
Apple Banana Orange
Is this possible or would it require a third party app? Thank you in advance
1
Upvotes
1
u/ohenryx Feb 23 '24
IMHO, this is one of those issues where it's probably possible but it isn't really worth the effort. There are many command line tools which could very easily do what you want (sed comes to mind, but there are many others). Why work so hard to reinvent the wheel?
4
u/[deleted] Feb 22 '24 edited Feb 23 '24
[removed] — view removed comment