General > Off-Topic
Help with bulk deletion
Bryantdl7:
So I am trying to find a way to delete all strings that contain "new" in the script structure below
--- Code: ---"STEAM_0:0"
{
"name" "mX"
"deny"
{
}
"allow"
{
}
"group" "new"
}
--- End code ---
However, as you can tell I am working with steam ID's so it is not as simple as imputting it into ms word and doing a replace action, I want to delete everything I put inside that code box above. I was wondering if anyone knows of a program that can delete the entire string if it contains a certain variable, such as "group" "new"
I am cleaning out my users.txt file as it has over 41 thousand lines, and i want to quickly delete everyone from the database while saving my staff from being deleted.
If I confused you guys I can try and explain it better
roastchicken:
Use notepad++'s replace feature. It accepts regex expressions and you can just replace it with nothing.
--- Code: ---"STEAM_0:(0|1):\d+"\s\n{\n\s
--- End code ---
matches a steamid followed by the first brace and some spaces and newlines
--- Code: ---"deny"\s\n\s{\n\s\}\n\s
--- End code ---
matches "deny" followed by some spaces, new lines, and braces
--- Code: ---"allow"\s\n\s{\n\s\}\n\s
--- End code ---
matches "allow" followed by some spaces, new lines, and braces
--- Code: ---"name"\s".+\n\s
--- End code ---
matches "name" and someones name, followed by some spaces and new lines
--- Code: ---"group"\s"new"\n\}\n
--- End code ---
matches "group" and "new", followed by some spaces and new lines and the closing brace and then another newline
all put together:
--- Code: ---"STEAM_0:(0|1):\d+"\s\n{\n\s"deny"\s\n\s{\n\s\}\n\s"allow"\s\n\s{\n\s\}\n\s"name"\s".+\n\s"group"\s".+"\n\}\n
--- End code ---
Of course because of the genius of users.txt, the deny, allow, and name fields can be in any order. Hip hurray! (I'm sure there must be a good reason for this, and I'm curious what that reason is. It's just also pretty irritating.)
Just go ahead and re-order those three elements (total of six possible combinations) and you should be able to get them all.
Bryantdl7:
Thank you so much! It worked perfectly! users.txt 407kb down to 41 kb!
+Rep
Aaron113:
--- Quote from: roastchicken on September 23, 2015, 12:12:32 PM ---Use notepad++'s replace feature. It accepts regex expressions and you can just replace it with nothing.
--- End quote ---
I really need to learn more about regex haha, looks powerful.
roastchicken:
Yea I've never used it before, but it seemed like it would work for this. I just used an online regex tester that also had a regex cheatsheet. It was much easier than I expected.
Navigation
[0] Message Index
[#] Next page
Go to full version